Merge branch 'devel'
This commit is contained in:
commit
6f1d9082b5
383 changed files with 20495 additions and 38001 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
||||||
.*
|
.*
|
||||||
*.pyc
|
*.pyc
|
||||||
/files
|
/files
|
||||||
python_apps/pypo/liquidsoap/liquidsoap
|
python_apps/pypo/liquidsoap_bin/liquidsoap
|
||||||
build/build.properties
|
build/build.properties
|
||||||
|
|
|
@ -127,6 +127,7 @@
|
||||||
<formFile formName="AddShowAbsoluteRebroadcastDates"/>
|
<formFile formName="AddShowAbsoluteRebroadcastDates"/>
|
||||||
<formFile formName="SoundcloudPreferences"/>
|
<formFile formName="SoundcloudPreferences"/>
|
||||||
<formFile formName="GeneralPreferences"/>
|
<formFile formName="GeneralPreferences"/>
|
||||||
|
<formFile formName="WatchedDirPreferences"/>
|
||||||
</formsDirectory>
|
</formsDirectory>
|
||||||
<layoutsDirectory enabled="false"/>
|
<layoutsDirectory enabled="false"/>
|
||||||
<modelsDirectory>
|
<modelsDirectory>
|
||||||
|
@ -378,18 +379,18 @@
|
||||||
<testApplicationDirectory>
|
<testApplicationDirectory>
|
||||||
<testApplicationBootstrapFile filesystemName="bootstrap.php"/>
|
<testApplicationBootstrapFile filesystemName="bootstrap.php"/>
|
||||||
<testApplicationControllerDirectory>
|
<testApplicationControllerDirectory>
|
||||||
<testApplicationControllerFile filesystemName="PlaylistControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="LibraryControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="PluploadControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="SearchControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="LoginControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="ScheduleControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="ApiControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="UserControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="NowplayingControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="PreferenceControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="DashboardControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
<testApplicationControllerFile filesystemName="RecorderControllerTest.php"/>
|
<testApplicationControllerFile/>
|
||||||
</testApplicationControllerDirectory>
|
</testApplicationControllerDirectory>
|
||||||
</testApplicationDirectory>
|
</testApplicationDirectory>
|
||||||
<testLibraryDirectory>
|
<testLibraryDirectory>
|
||||||
|
|
4
CREDITS
4
CREDITS
|
@ -2,6 +2,10 @@
|
||||||
CREDITS
|
CREDITS
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
Version 1.9.0
|
||||||
|
-------------
|
||||||
|
Same as previous version.
|
||||||
|
|
||||||
Version 1.8.2
|
Version 1.8.2
|
||||||
-------------
|
-------------
|
||||||
Welcome to James Moon!
|
Welcome to James Moon!
|
||||||
|
|
73
Changelog
73
Changelog
|
@ -1,4 +1,72 @@
|
||||||
1.8.2 - May 25, 2011
|
1.9.0 - August 9, 2011
|
||||||
|
|
||||||
|
The cool stuff:
|
||||||
|
* New file storage system.
|
||||||
|
- Human-readable file structure. The directory structure and file names on
|
||||||
|
disk are now human-readable. This means you can easily find files using
|
||||||
|
your file browser on your server.
|
||||||
|
- Magic file synchronization. Edits to your files are automatically
|
||||||
|
noticed by Airtime. If you edit any files on disk, such as trimming the
|
||||||
|
length of a track, Airtime will automatically notice this and adjust the
|
||||||
|
playlist lengths and shows for that audio file.
|
||||||
|
- Auto-import and multiple-directory support. You can set any number of
|
||||||
|
directories to be watched by Airtime. Any new files you add to watched
|
||||||
|
directories will be automatically imported into Airtime, and any deleted
|
||||||
|
files will be automatically removed.
|
||||||
|
- The "airtime-import" command line tool can now set watched directories
|
||||||
|
and change the storage directory.
|
||||||
|
- Graceful recovery from reboot. If the playout engine starts up and
|
||||||
|
detects that a show should be playing at the current time, it will skip
|
||||||
|
to the right point in the track and start playing. Previously, Airtime
|
||||||
|
would not play anything until the next show started. This also fixes a
|
||||||
|
problem where the metadata on the stream was lost when a file had
|
||||||
|
cue-in/out values set. Thanks to the Liquidsoap developers for
|
||||||
|
implementing the ability to do all of this!
|
||||||
|
- Output to Shoutcast. Now both Shoutcast and Icecast are supported.
|
||||||
|
- A new "Program Manager" role. A program manager can create shows but
|
||||||
|
can't change the preferences or modify users.
|
||||||
|
- No more rebooting after install! Airtime now uses standard SystemV initd
|
||||||
|
scripts instead of non-standard daemontools. This also makes for a much
|
||||||
|
faster install.
|
||||||
|
- Frontend widgets are much easier to use and their theme can be modified
|
||||||
|
with CSS (Click here for more info and installation instructions).
|
||||||
|
- Improved installation - only one command to install on Ubuntu!
|
||||||
|
|
||||||
|
* Improvements:
|
||||||
|
- Cumulative time shown on playlists. The Playlist Builder now shows the
|
||||||
|
total time since the beginning of the playlist for each song.
|
||||||
|
- "End Time" instead of "Duration". In the Add/Edit Show dialog, we
|
||||||
|
replaced the "Duration" field with "End Time". Users reported that this
|
||||||
|
was a much more intuitive way to schedule the show. Duration is still
|
||||||
|
shown as a read-only field.
|
||||||
|
- Feedback & promotion system. Airtime now includes a way to send feedback
|
||||||
|
and promote your site on the Sourcefabric web page. This will greatly
|
||||||
|
enhance our ability to understand who is using the software, which in
|
||||||
|
turn will allow us to make appropriate features and receive grant
|
||||||
|
funding.
|
||||||
|
- The show recorder can now instantly cancel a show thanks to the use of
|
||||||
|
RabbitMQ.
|
||||||
|
- Only admins have the ability to delete files now.
|
||||||
|
- The playout engine now runs with a higher priority. This should help
|
||||||
|
prevent any problems with audio skipping.
|
||||||
|
- Airtime has been contained. It is now easier to run other apps on the
|
||||||
|
same system with Airtime because it no longer messes with the system-wide
|
||||||
|
Python or PHP configurations. The python libraries needed for Airtime are
|
||||||
|
now contained in a local Python virtualenv, and the PHP config variables
|
||||||
|
are set in the Apache virtualhost and .htaccess files.
|
||||||
|
- Message indicating import status is now displayed on Playlist Builder
|
||||||
|
page( above the search box).
|
||||||
|
|
||||||
|
* Bug fixes:
|
||||||
|
- Fixed bug where you couldn't import a file with a name longer than 255
|
||||||
|
characters.
|
||||||
|
- Fixed bug where searching an audio archive of 15K+ files was slow.
|
||||||
|
- Fixed bug where upgrading from more than one version back
|
||||||
|
(e.g. 1.8.0 -> 1.9.0) did not work.
|
||||||
|
- Fixed bug where the wrong file length was reported for very large CBR
|
||||||
|
mp3 files (thanks to mutagen developers for the patch!)
|
||||||
|
|
||||||
|
1.8.2 - June 8, 2011
|
||||||
Highlights:
|
Highlights:
|
||||||
* Improvements:
|
* Improvements:
|
||||||
- You can now download audio files from the search screen and from the "Show Content" screen.
|
- You can now download audio files from the search screen and from the "Show Content" screen.
|
||||||
|
@ -23,7 +91,8 @@ Highlights:
|
||||||
- Fixed problem with Record Check box occasionally being greyed-out when creating new show
|
- Fixed problem with Record Check box occasionally being greyed-out when creating new show
|
||||||
- Fixed a problem with default genre not being applied to recorded shows
|
- Fixed a problem with default genre not being applied to recorded shows
|
||||||
- Fixed a problem where shows repeating bi-weekly or monthly did not update properly when edited.
|
- Fixed a problem where shows repeating bi-weekly or monthly did not update properly when edited.
|
||||||
|
- Fixed problem when a user changed the name of a recorded show right before it started playing would cause the recorded audio not to be linked to the show.
|
||||||
|
- and many more...
|
||||||
|
|
||||||
1.8.1 - May 2, 2011
|
1.8.1 - May 2, 2011
|
||||||
* Fixed issue where an track's progress bar would keep updating, even if the track was no longer playing.
|
* Fixed issue where an track's progress bar would keep updating, even if the track was no longer playing.
|
||||||
|
|
|
@ -1,78 +1,73 @@
|
||||||
This application uses the following 3rd Party software:
|
This application uses the following 3rd Party software:
|
||||||
|
|
||||||
------------
|
----------------------
|
||||||
|
Common Non-linked Code
|
||||||
|
----------------------
|
||||||
|
* Linux (Ubuntu & Debian)
|
||||||
|
|
||||||
|
* RabbitMQ (works with version 1.7.2 and above)
|
||||||
|
- What is it: Interprocess Message Passing with Queuing
|
||||||
|
- Web site: http://www.rabbitmq.com/
|
||||||
|
- License: Mozilla Public License (http://www.rabbitmq.com/mpl.html)
|
||||||
|
|
||||||
|
* monit
|
||||||
|
- What is it: Monitors processes and restarts them if they die
|
||||||
|
- Web site: http://mmonit.com/monit/
|
||||||
|
- License: GPLv3
|
||||||
|
|
||||||
|
-----------
|
||||||
|
Airtime Web
|
||||||
|
-----------
|
||||||
Linked code:
|
Linked code:
|
||||||
------------
|
|
||||||
* Zend Framework 1.10.3
|
* Zend Framework 1.10.3
|
||||||
|
- What is it: Framework for PHP web apps
|
||||||
- Web site: http://framework.zend.com/
|
- Web site: http://framework.zend.com/
|
||||||
- License: New BSD license
|
- License: New BSD license
|
||||||
- Compatible with GPLv3: Yes
|
- Compatible with GPLv3: Yes
|
||||||
|
|
||||||
* PEAR
|
* PEAR
|
||||||
|
- What is it: PHP library
|
||||||
- Notes: We only use the PEAR base class PEAR_Error, in the "PEAR" PEAR library.
|
- Notes: We only use the PEAR base class PEAR_Error, in the "PEAR" PEAR library.
|
||||||
- License: New BSD License
|
- License: New BSD License
|
||||||
- Compatible with GPLv3? Yes.
|
- Compatible with GPLv3? Yes.
|
||||||
|
|
||||||
* GetID3
|
|
||||||
- Web site: http://getid3.sourceforge.net/
|
|
||||||
- License: GPLv2
|
|
||||||
- Compatible with GPLv3? Yes
|
|
||||||
|
|
||||||
* Propel ORM
|
* Propel ORM
|
||||||
|
- What is it: Maps DB data into PHP objects
|
||||||
- Web site: http://www.propelorm.org/
|
- Web site: http://www.propelorm.org/
|
||||||
- License: MIT/Expat License
|
- License: MIT/Expat License
|
||||||
- Compatible with the GPL: Yes. See http://www.gnu.org/licenses/license-list.html
|
- Compatible with the GPL: Yes. See http://www.gnu.org/licenses/license-list.html
|
||||||
|
|
||||||
* Phing
|
* Phing
|
||||||
|
- 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 development, not needed to run Airtime.
|
||||||
- License: LGPLv3
|
- License: LGPLv3
|
||||||
|
|
||||||
* Soundcloud php api wrapper
|
|
||||||
- Web site: https://github.com/mptre/php-soundcloud/blob/master/Services/Soundcloud.php
|
|
||||||
- License: MIT
|
|
||||||
- Compatible with the GPL: Yes. See http://www.gnu.org/licenses/license-list.html
|
|
||||||
|
|
||||||
* Kombu
|
|
||||||
- Web site: http://pypi.python.org/pypi/kombu/
|
|
||||||
- License: New BSD
|
|
||||||
- Compatible with GPLv3? Yes.
|
|
||||||
|
|
||||||
* PHP-AMQPLIB
|
* PHP-AMQPLIB
|
||||||
|
- What is it: PHP library to interact with RabbitMQ
|
||||||
- Web site: https://github.com/tnc/php-amqplib
|
- Web site: https://github.com/tnc/php-amqplib
|
||||||
- License: LGPLv2.1
|
- License: LGPLv2.1
|
||||||
- Compatible with GPLv3? Yes
|
- Compatible with GPLv3? Yes
|
||||||
|
|
||||||
----------------
|
* Soundcloud PHP API wrapper
|
||||||
Non-linked code:
|
- What is it: PHP library to upload to SoundCloud
|
||||||
----------------
|
- Web site: https://github.com/mptre/php-soundcloud/blob/master/Services/Soundcloud.php
|
||||||
* Linux
|
- License: MIT
|
||||||
|
- Compatible with the GPL: Yes. See http://www.gnu.org/licenses/license-list.html
|
||||||
|
|
||||||
|
Non-linked code:
|
||||||
* Apache Web Server 2.2
|
* Apache Web Server 2.2
|
||||||
- Web site: http://httpd.apache.org/
|
- Web site: http://httpd.apache.org/
|
||||||
|
- License: Apache 2.0. See http://httpd.apache.org/docs/2.2/license.html
|
||||||
|
|
||||||
* PostgreSQL 8.4
|
* PostgreSQL 8.4
|
||||||
- Web site: http://www.postgresql.org/
|
- Web site: http://www.postgresql.org/
|
||||||
- License: The PostgreSQL License. See http://www.opensource.org/licenses/postgresql
|
- License: The PostgreSQL License. See http://www.postgresql.org/about/licence
|
||||||
|
|
||||||
* PHP 5.3
|
* PHP 5.3
|
||||||
- Web site: http://www.php.net/
|
- Web site: http://www.php.net/
|
||||||
- License: The PHP License. See http://www.php.net/license/3_01.txt
|
- License: The PHP License. See http://www.php.net/license/3_01.txt
|
||||||
|
|
||||||
* Python 2.6
|
|
||||||
- Web site: http://www.python.org/
|
|
||||||
- License: PSF License. See http://docs.python.org/license.html
|
|
||||||
|
|
||||||
* Liquidsoap (pre-release of 1.0)
|
|
||||||
- Web site: http://savonet.sourceforge.net/
|
|
||||||
- License: GPLv2
|
|
||||||
|
|
||||||
* mp3cut from the package poc-streamer
|
|
||||||
|
|
||||||
* ecasound 2.7.2
|
|
||||||
- Web site: http://www.eca.cx/ecasound/
|
|
||||||
- License: GPLv2
|
|
||||||
|
|
||||||
* jQuery
|
* jQuery
|
||||||
- Web site: http://jquery.com/
|
- Web site: http://jquery.com/
|
||||||
- License: MIT and GPL. See http://jquery.org/license
|
- License: MIT and GPL. See http://jquery.org/license
|
||||||
|
@ -106,5 +101,75 @@ Non-linked code:
|
||||||
- Web site: http://fgelinas.com/code/timepicker/
|
- Web site: http://fgelinas.com/code/timepicker/
|
||||||
- License: Dual licensed under the MIT or GPL Version 2 licenses.
|
- License: Dual licensed under the MIT or GPL Version 2 licenses.
|
||||||
|
|
||||||
|
* Data Tables
|
||||||
|
- Web site: http://www.datatables.net/
|
||||||
|
- License: GPLv2 or BSD 3-Clause
|
||||||
|
|
||||||
|
* Server Browse
|
||||||
|
- Web site: http://code.google.com/p/jq-serverbrowse/
|
||||||
|
- License: BSD 2-Clause
|
||||||
|
|
||||||
|
-------------
|
||||||
|
Media-Monitor
|
||||||
|
-------------
|
||||||
|
Linked code:
|
||||||
|
* Mutagen
|
||||||
|
- What is it: Parser of audio file metadata
|
||||||
|
- Web site: http://code.google.com/p/mutagen/
|
||||||
|
- License: GPLv2-only
|
||||||
|
|
||||||
|
* Kombu
|
||||||
|
- What is it: Python interface to RabbitMQ
|
||||||
|
- Web site: http://pypi.python.org/pypi/kombu/
|
||||||
|
- License: New BSD
|
||||||
|
- Compatible with GPLv3? Yes.
|
||||||
|
|
||||||
|
* pyinotify
|
||||||
|
- Python interface to inotify
|
||||||
|
- Web site: https://github.com/seb-m/pyinotify
|
||||||
|
- License: MIT
|
||||||
|
|
||||||
|
Non-linked code:
|
||||||
|
* Python 2.6
|
||||||
|
- Web site: http://www.python.org/
|
||||||
|
- License: PSF License. See http://docs.python.org/license.html
|
||||||
|
|
||||||
|
-------------
|
||||||
|
Show Recorder
|
||||||
|
-------------
|
||||||
|
Linked code:
|
||||||
|
* Kombu
|
||||||
|
- What is it: Python interface to RabbitMQ
|
||||||
|
- Web site: http://pypi.python.org/pypi/kombu/
|
||||||
|
- License: New BSD
|
||||||
|
- Compatible with GPLv3? Yes.
|
||||||
|
|
||||||
|
Non-linked code:
|
||||||
|
* Python 2.6
|
||||||
|
- Web site: http://www.python.org/
|
||||||
|
- License: PSF License. See http://docs.python.org/license.html
|
||||||
|
|
||||||
|
* ecasound 2.7.2
|
||||||
|
- What is it: Records audio from line-in
|
||||||
|
- Web site: http://www.eca.cx/ecasound/
|
||||||
|
- License: GPLv2
|
||||||
|
|
||||||
|
----
|
||||||
|
Pypo
|
||||||
|
----
|
||||||
|
Linked code:
|
||||||
|
* Kombu
|
||||||
|
- Web site: http://pypi.python.org/pypi/kombu/
|
||||||
|
- License: New BSD
|
||||||
|
- Compatible with GPLv3? Yes.
|
||||||
|
|
||||||
|
Non-linked code:
|
||||||
|
* Python 2.6
|
||||||
|
- Web site: http://www.python.org/
|
||||||
|
- License: PSF License. See http://docs.python.org/license.html
|
||||||
|
|
||||||
|
* Liquidsoap (pre-release of 1.0)
|
||||||
|
- Web site: http://savonet.sourceforge.net/
|
||||||
|
- License: GPLv2
|
||||||
|
|
||||||
|
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1,2 +1,2 @@
|
||||||
PRODUCT_ID=Airtime
|
PRODUCT_ID=Airtime
|
||||||
PRODUCT_RELEASE=1.8.2
|
PRODUCT_RELEASE=1.9.0
|
||||||
|
|
|
@ -16,6 +16,7 @@ require_once __DIR__."/configs/conf.php";
|
||||||
require_once 'DB.php';
|
require_once 'DB.php';
|
||||||
|
|
||||||
require_once 'Soundcloud.php';
|
require_once 'Soundcloud.php';
|
||||||
|
require_once 'MusicDir.php';
|
||||||
require_once 'Playlist.php';
|
require_once 'Playlist.php';
|
||||||
require_once 'StoredFile.php';
|
require_once 'StoredFile.php';
|
||||||
require_once 'Schedule.php';
|
require_once 'Schedule.php';
|
||||||
|
|
|
@ -6,7 +6,8 @@ $ccAcl = new Zend_Acl();
|
||||||
|
|
||||||
$ccAcl->addRole(new Zend_Acl_Role('G'))
|
$ccAcl->addRole(new Zend_Acl_Role('G'))
|
||||||
->addRole(new Zend_Acl_Role('H'), 'G')
|
->addRole(new Zend_Acl_Role('H'), 'G')
|
||||||
->addRole(new Zend_Acl_Role('A'), 'H');
|
->addRole(new Zend_Acl_Role('P'), 'H')
|
||||||
|
->addRole(new Zend_Acl_Role('A'), 'P');
|
||||||
|
|
||||||
$ccAcl->add(new Zend_Acl_Resource('library'))
|
$ccAcl->add(new Zend_Acl_Resource('library'))
|
||||||
->add(new Zend_Acl_Resource('index'))
|
->add(new Zend_Acl_Resource('index'))
|
||||||
|
|
|
@ -8,6 +8,13 @@ return array (
|
||||||
'BaseCcAccessPeer' => 'airtime/om/BaseCcAccessPeer.php',
|
'BaseCcAccessPeer' => 'airtime/om/BaseCcAccessPeer.php',
|
||||||
'BaseCcAccess' => 'airtime/om/BaseCcAccess.php',
|
'BaseCcAccess' => 'airtime/om/BaseCcAccess.php',
|
||||||
'BaseCcAccessQuery' => 'airtime/om/BaseCcAccessQuery.php',
|
'BaseCcAccessQuery' => 'airtime/om/BaseCcAccessQuery.php',
|
||||||
|
'CcMusicDirsTableMap' => 'airtime/map/CcMusicDirsTableMap.php',
|
||||||
|
'CcMusicDirsPeer' => 'airtime/CcMusicDirsPeer.php',
|
||||||
|
'CcMusicDirs' => 'airtime/CcMusicDirs.php',
|
||||||
|
'CcMusicDirsQuery' => 'airtime/CcMusicDirsQuery.php',
|
||||||
|
'BaseCcMusicDirsPeer' => 'airtime/om/BaseCcMusicDirsPeer.php',
|
||||||
|
'BaseCcMusicDirs' => 'airtime/om/BaseCcMusicDirs.php',
|
||||||
|
'BaseCcMusicDirsQuery' => 'airtime/om/BaseCcMusicDirsQuery.php',
|
||||||
'CcFilesTableMap' => 'airtime/map/CcFilesTableMap.php',
|
'CcFilesTableMap' => 'airtime/map/CcFilesTableMap.php',
|
||||||
'CcFilesPeer' => 'airtime/CcFilesPeer.php',
|
'CcFilesPeer' => 'airtime/CcFilesPeer.php',
|
||||||
'CcFiles' => 'airtime/CcFiles.php',
|
'CcFiles' => 'airtime/CcFiles.php',
|
||||||
|
@ -106,4 +113,11 @@ return array (
|
||||||
'BaseCcSubjsPeer' => 'airtime/om/BaseCcSubjsPeer.php',
|
'BaseCcSubjsPeer' => 'airtime/om/BaseCcSubjsPeer.php',
|
||||||
'BaseCcSubjs' => 'airtime/om/BaseCcSubjs.php',
|
'BaseCcSubjs' => 'airtime/om/BaseCcSubjs.php',
|
||||||
'BaseCcSubjsQuery' => 'airtime/om/BaseCcSubjsQuery.php',
|
'BaseCcSubjsQuery' => 'airtime/om/BaseCcSubjsQuery.php',
|
||||||
|
'CcCountryTableMap' => 'airtime/map/CcCountryTableMap.php',
|
||||||
|
'CcCountryPeer' => 'airtime/CcCountryPeer.php',
|
||||||
|
'CcCountry' => 'airtime/CcCountry.php',
|
||||||
|
'CcCountryQuery' => 'airtime/CcCountryQuery.php',
|
||||||
|
'BaseCcCountryPeer' => 'airtime/om/BaseCcCountryPeer.php',
|
||||||
|
'BaseCcCountry' => 'airtime/om/BaseCcCountry.php',
|
||||||
|
'BaseCcCountryQuery' => 'airtime/om/BaseCcCountryQuery.php',
|
||||||
);
|
);
|
|
@ -65,11 +65,7 @@ class Config {
|
||||||
|
|
||||||
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
|
||||||
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
$CC_CONFIG['basePort'] = $values['general']['base_port'];
|
||||||
|
|
||||||
$CC_CONFIG['baseFilesDir'] = $values['general']['base_files_dir'];
|
|
||||||
// main directory for storing binary media files
|
|
||||||
$CC_CONFIG['storageDir'] = $values['general']['base_files_dir']."/stor";
|
|
||||||
|
|
||||||
// Database config
|
// Database config
|
||||||
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
|
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
|
||||||
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
|
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
|
||||||
|
|
|
@ -1,22 +1,34 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('AIRTIME_VERSION', '1.8.2');
|
define('AIRTIME_VERSION', '1.9.0');
|
||||||
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
|
||||||
define('AIRTIME_REST_VERSION', '1.1');
|
define('AIRTIME_REST_VERSION', '1.1');
|
||||||
|
|
||||||
// Metadata Keys
|
// Metadata Keys for files
|
||||||
define('UI_MDATA_KEY_TITLE', 'dc:title');
|
define('MDATA_KEY_FILEPATH', 'filepath');
|
||||||
define('UI_MDATA_KEY_CREATOR', 'dc:creator');
|
define('MDATA_KEY_MD5', 'md5');
|
||||||
define('UI_MDATA_KEY_SOURCE', 'dc:source');
|
define('MDATA_KEY_TITLE', 'track_title');
|
||||||
define('UI_MDATA_KEY_DURATION', 'dcterms:extent');
|
define('MDATA_KEY_CREATOR', 'artist_name');
|
||||||
define('UI_MDATA_KEY_URL', 'ls:url');
|
define('MDATA_KEY_SOURCE', 'album_title');
|
||||||
define('UI_MDATA_KEY_FORMAT', 'dc:format');
|
define('MDATA_KEY_DURATION', 'length');
|
||||||
define('UI_MDATA_KEY_DESCRIPTION', 'dc:description');
|
define('MDATA_KEY_MIME', 'mime');
|
||||||
define('UI_MDATA_KEY_CHANNELS', 'ls:channels');
|
define('MDATA_KEY_FTYPE', 'ftype');
|
||||||
define('UI_MDATA_KEY_SAMPLERATE', 'ls:samplerate');
|
define('MDATA_KEY_URL', 'info_url');
|
||||||
define('UI_MDATA_KEY_BITRATE', 'ls:bitrate');
|
define('MDATA_KEY_GENRE', 'genre');
|
||||||
define('UI_MDATA_KEY_ENCODER', 'ls:encoder');
|
define('MDATA_KEY_MOOD', 'mood');
|
||||||
define('UI_MDATA_KEY_FILENAME', 'ls:filename');
|
define('MDATA_KEY_LABEL', 'label');
|
||||||
|
define('MDATA_KEY_COMPOSER', 'composer');
|
||||||
|
define('MDATA_KEY_DESCRIPTION', 'description');
|
||||||
|
define('MDATA_KEY_SAMPLERATE', 'sample_rate');
|
||||||
|
define('MDATA_KEY_BITRATE', 'bit_rate');
|
||||||
|
define('MDATA_KEY_ENCODER', 'encoded_by');
|
||||||
|
define('MDATA_KEY_ISRC', 'isrc_number');
|
||||||
|
define('MDATA_KEY_COPYRIGHT', 'copyright');
|
||||||
|
define('MDATA_KEY_YEAR', 'year');
|
||||||
|
define('MDATA_KEY_BPM', 'bpm');
|
||||||
|
define('MDATA_KEY_TRACKNUMBER', 'track_number');
|
||||||
|
define('MDATA_KEY_CONDUCTOR', 'conductor');
|
||||||
|
define('MDATA_KEY_LANGUAGE', 'language');
|
||||||
|
|
||||||
define('UI_MDATA_VALUE_FORMAT_FILE', 'File');
|
define('UI_MDATA_VALUE_FORMAT_FILE', 'File');
|
||||||
define('UI_MDATA_VALUE_FORMAT_STREAM', 'live stream');
|
define('UI_MDATA_VALUE_FORMAT_STREAM', 'live stream');
|
||||||
|
|
|
@ -52,6 +52,12 @@ $pages = array(
|
||||||
'controller' => 'user',
|
'controller' => 'user',
|
||||||
'action' => 'add-user',
|
'action' => 'add-user',
|
||||||
'resource' => 'user'
|
'resource' => 'user'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'label' => 'Manage Media Folders',
|
||||||
|
'module' => 'default',
|
||||||
|
'controller' => 'Preference',
|
||||||
|
'action' => 'directory-config'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,8 +9,16 @@ 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('upload-file', 'json')
|
||||||
->addActionContext('upload-recorded', 'json')
|
->addActionContext('upload-recorded', 'json')
|
||||||
|
->addActionContext('media-monitor-setup', 'json')
|
||||||
|
->addActionContext('media-item-status', 'json')
|
||||||
->addActionContext('reload-metadata', 'json')
|
->addActionContext('reload-metadata', 'json')
|
||||||
|
->addActionContext('list-all-files', 'json')
|
||||||
|
->addActionContext('list-all-watched-dirs', 'json')
|
||||||
|
->addActionContext('add-watched-dir', 'json')
|
||||||
|
->addActionContext('remove-watched-dir', 'json')
|
||||||
|
->addActionContext('set-storage-dir', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +28,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Airtime version. i.e "1.7.0 alpha"
|
* Returns Airtime version. i.e "1.7.0-beta"
|
||||||
*
|
*
|
||||||
* 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
|
||||||
|
@ -52,7 +60,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
* Allows remote client to download requested media file.
|
* Allows remote client to download requested media file.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* The given value increased by the increment amount.
|
*
|
||||||
*/
|
*/
|
||||||
public function getMediaAction()
|
public function getMediaAction()
|
||||||
{
|
{
|
||||||
|
@ -63,13 +71,17 @@ class ApiController extends Zend_Controller_Action
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
$api_key = $this->_getParam('api_key');
|
$api_key = $this->_getParam('api_key');
|
||||||
$download = $this->_getParam('download');
|
$download = ("true" == $this->_getParam('download'));
|
||||||
|
|
||||||
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
|
$logger = Logging::getLogger();
|
||||||
|
|
||||||
|
if(!in_array($api_key, $CC_CONFIG["apiKey"]) &&
|
||||||
|
is_null(Zend_Auth::getInstance()->getStorage()->read()))
|
||||||
{
|
{
|
||||||
header('HTTP/1.0 401 Unauthorized');
|
header('HTTP/1.0 401 Unauthorized');
|
||||||
print 'You are not allowed to access this resource.';
|
print 'You are not allowed to access this resource.';
|
||||||
exit;
|
$logger->info("401 Unauthorized");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = $this->_getParam("file");
|
$filename = $this->_getParam("file");
|
||||||
|
@ -77,43 +89,56 @@ class ApiController extends Zend_Controller_Action
|
||||||
if (ctype_alnum($file_id) && strlen($file_id) == 32) {
|
if (ctype_alnum($file_id) && strlen($file_id) == 32) {
|
||||||
$media = StoredFile::RecallByGunid($file_id);
|
$media = StoredFile::RecallByGunid($file_id);
|
||||||
if ($media != null && !PEAR::isError($media)) {
|
if ($media != null && !PEAR::isError($media)) {
|
||||||
$filepath = $media->getRealFilePath();
|
$filepath = $media->getFilePath();
|
||||||
if(!is_file($filepath))
|
if(is_file($filepath)){
|
||||||
{
|
// possibly use fileinfo module here in the future.
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
// http://www.php.net/manual/en/book.fileinfo.php
|
||||||
//print 'Resource in database, but not in storage. Sorry.';
|
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||||
|
if ($ext == "ogg")
|
||||||
|
header("Content-Type: audio/ogg");
|
||||||
|
else if ($ext == "mp3")
|
||||||
|
header("Content-Type: audio/mpeg");
|
||||||
|
if ($download){
|
||||||
|
//path_info breaks up a file path into seperate pieces of informaiton.
|
||||||
|
//We just want the basename which is the file name with the path
|
||||||
|
//information stripped away. We are using Content-Disposition to specify
|
||||||
|
//to the browser what name the file should be saved as.
|
||||||
|
//
|
||||||
|
// By james.moon:
|
||||||
|
// I'm removing pathinfo() since it strips away UTF-8 characters.
|
||||||
|
// Using manualy parsing
|
||||||
|
$full_path = $media->getPropelOrm()->getDbFilepath();
|
||||||
|
$file_base_name = strrchr($full_path, '/');
|
||||||
|
$file_base_name = substr($file_base_name, 1);
|
||||||
|
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||||
|
}
|
||||||
|
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;
|
exit;
|
||||||
|
} else {
|
||||||
|
$logger->err('Resource in database, but not in storage: "'.$filepath.'"');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$logger->err('$media != null && !PEAR::isError($media)');
|
||||||
// possibly use fileinfo module here in the future.
|
|
||||||
// http://www.php.net/manual/en/book.fileinfo.php
|
|
||||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
|
||||||
if ($ext == "ogg")
|
|
||||||
header("Content-Type: audio/ogg");
|
|
||||||
else if ($ext == "mp3")
|
|
||||||
header("Content-Type: audio/mpeg");
|
|
||||||
if ($download){
|
|
||||||
header('Content-Disposition: attachment; filename="'.$media->getName().'"');
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$logger->err('ctype_alnum($file_id) && strlen($file_id) == 32');
|
||||||
}
|
}
|
||||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
||||||
exit;
|
$logger->info("404 Not Found");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function liveInfoAction()
|
public function liveInfoAction()
|
||||||
|
@ -282,6 +307,24 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function uploadFileAction()
|
||||||
|
{
|
||||||
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$api_key = $this->_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$upload_dir = ini_get("upload_tmp_dir");
|
||||||
|
StoredFile::uploadFile($upload_dir);
|
||||||
|
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||||
|
StoredFile::copyFileToStor($upload_dir, $fileName);
|
||||||
|
}
|
||||||
|
|
||||||
public function uploadRecordedAction()
|
public function uploadRecordedAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
@ -293,18 +336,24 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this file id is the recording for this show instance.
|
||||||
|
$show_instance_id = $this->_getParam('showinstanceid');
|
||||||
|
$file_id = $this->_getParam('fileid');
|
||||||
|
|
||||||
|
$this->view->fileid = $file_id;
|
||||||
|
$this->view->showinstanceid = $show_instance_id;
|
||||||
|
|
||||||
|
|
||||||
$showCanceled = false;
|
$showCanceled = false;
|
||||||
$show_instance = $this->_getParam('show_instance');
|
$file = StoredFile::Recall($file_id);
|
||||||
|
//$show_instance = $this->_getParam('show_instance');
|
||||||
$upload_dir = ini_get("upload_tmp_dir");
|
|
||||||
$file = StoredFile::uploadFile($upload_dir);
|
$show_name = null;
|
||||||
|
|
||||||
$show_name = "";
|
|
||||||
try {
|
try {
|
||||||
$show_inst = new ShowInstance($show_instance);
|
$show_inst = new ShowInstance($show_instance_id);
|
||||||
|
|
||||||
$show_inst->setRecordedFile($file->getId());
|
$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 = $show_inst->getShowStart();
|
||||||
|
@ -317,12 +366,19 @@ class ApiController extends Zend_Controller_Action
|
||||||
//the library), now lets just return.
|
//the library), now lets just return.
|
||||||
$showCanceled = true;
|
$showCanceled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpTitle = !(empty($show_name))?$show_name."-":"";
|
if (isset($show_name)) {
|
||||||
$tmpTitle .= $file->getName();
|
$tmpTitle = "$show_name-$show_start_time";
|
||||||
|
$tmpTitle = str_replace(" ", "-", $tmpTitle);
|
||||||
$file->setMetadataValue(UI_MDATA_KEY_TITLE, $tmpTitle);
|
}
|
||||||
|
else {
|
||||||
|
$tmpTitle = $file->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
$file->setMetadataValue('MDATA_KEY_TITLE', $tmpTitle);
|
||||||
|
$file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder");
|
||||||
|
$file->setMetadataValue('MDATA_KEY_TRACKNUMBER', null);
|
||||||
|
|
||||||
if (!$showCanceled && Application_Model_Preference::GetDoSoundCloudUpload())
|
if (!$showCanceled && Application_Model_Preference::GetDoSoundCloudUpload())
|
||||||
{
|
{
|
||||||
for ($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
|
for ($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
|
||||||
|
@ -335,7 +391,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$soundcloud = new ATSoundcloud();
|
$soundcloud = new ATSoundcloud();
|
||||||
$soundcloud_id = $soundcloud->uploadTrack($file->getRealFilePath(), $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);
|
$show_inst->setSoundCloudFileId($soundcloud_id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -350,13 +406,17 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->id = $file->getId();
|
$this->view->id = $file_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reloadMetadataAction() {
|
public function mediaMonitorSetupAction() {
|
||||||
|
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
// disable the view and the layout
|
||||||
|
$this->view->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
$api_key = $this->_getParam('api_key');
|
$api_key = $this->_getParam('api_key');
|
||||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||||
{
|
{
|
||||||
|
@ -365,22 +425,186 @@ class ApiController extends Zend_Controller_Action
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$md = $this->_getParam('md');
|
$this->view->stor = MusicDir::getStorDir()->getDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
$file = StoredFile::Recall(null, $md['gunid']);
|
public function reloadMetadataAction() {
|
||||||
if (PEAR::isError($file) || is_null($file)) {
|
global $CC_CONFIG;
|
||||||
$this->view->response = "File not in Airtime's Database";
|
|
||||||
return;
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $file->replaceDbMetadata($md);
|
$mode = $request->getParam('mode');
|
||||||
|
$params = $request->getParams();
|
||||||
|
|
||||||
if (PEAR::isError($res)) {
|
$md = array();
|
||||||
$this->view->response = "Metadata Change Failed";
|
//extract all file metadata params from the request.
|
||||||
|
foreach ($params as $key => $value) {
|
||||||
|
if (preg_match('/^MDATA_KEY/', $key)) {
|
||||||
|
$md[$key] = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$this->view->response = "Success!";
|
// update import timestamp
|
||||||
|
Application_Model_Preference::SetImportTimestamp();
|
||||||
|
|
||||||
|
if ($mode == "create") {
|
||||||
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
|
|
||||||
|
$file = StoredFile::RecallByFilepath($filepath);
|
||||||
|
|
||||||
|
if (is_null($file)) {
|
||||||
|
$file = StoredFile::Insert($md);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->view->error = "File already exists in Airtime.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if ($mode == "modify") {
|
||||||
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
|
$file = StoredFile::RecallByFilepath($filepath);
|
||||||
|
|
||||||
|
//File is not in database anymore.
|
||||||
|
if (is_null($file)) {
|
||||||
|
$this->view->error = "File does not exist in Airtime.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Updating a metadata change.
|
||||||
|
else {
|
||||||
|
$file->setMetadata($md);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($mode == "moved") {
|
||||||
|
$md5 = $md['MDATA_KEY_MD5'];
|
||||||
|
$file = StoredFile::RecallByMd5($md5);
|
||||||
|
|
||||||
|
if (is_null($file)) {
|
||||||
|
$this->view->error = "File doesn't exist in Airtime.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
|
$file->setFilePath($filepath);
|
||||||
|
//$file->setMetadata($md);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($mode == "delete") {
|
||||||
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
|
$filepath = str_replace("\\", "", $filepath);
|
||||||
|
$file = StoredFile::RecallByFilepath($filepath);
|
||||||
|
|
||||||
|
if (is_null($file)) {
|
||||||
|
$this->view->error = "File doesn't exist in Airtime.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$file->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->view->id = $file->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listAllFilesAction() {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
$dir_id = $request->getParam('dir_id');
|
||||||
|
|
||||||
|
$this->view->files = StoredFile::listAllFiles($dir_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listAllWatchedDirsAction() {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
$arrWatchedDirs = MusicDir::getWatchedDirs();
|
||||||
|
$storDir = MusicDir::getStorDir();
|
||||||
|
|
||||||
|
$result[$storDir->getId()] = $storDir->getDirectory();
|
||||||
|
|
||||||
|
foreach ($arrWatchedDirs as $watchedDir){
|
||||||
|
$result[$watchedDir->getId()] = $watchedDir->getDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->view->dirs = $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addWatchedDirAction() {
|
||||||
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$api_key = $request->getParam('api_key');
|
||||||
|
$path = base64_decode($request->getParam('path'));
|
||||||
|
|
||||||
|
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 = MusicDir::addWatchedDir($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeWatchedDirAction() {
|
||||||
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$api_key = $request->getParam('api_key');
|
||||||
|
$path = base64_decode($request->getParam('path'));
|
||||||
|
|
||||||
|
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 = MusicDir::removeWatchedDir($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStorageDirAction() {
|
||||||
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$api_key = $request->getParam('api_key');
|
||||||
|
$path = base64_decode($request->getParam('path'));
|
||||||
|
|
||||||
|
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 = MusicDir::setStorDir($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js');
|
$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/airtime/library/library.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
|
||||||
|
|
||||||
|
@ -54,18 +55,23 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
$type = $this->_getParam('type');
|
$type = $this->_getParam('type');
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
$params = '/format/json/id/#id#/type/#type#';
|
$params = '/format/json/id/#id#/type/#type#';
|
||||||
|
|
||||||
$paramsPop = str_replace('#id#', $id, $params);
|
$paramsPop = str_replace('#id#', $id, $params);
|
||||||
$paramsPop = str_replace('#type#', $type, $paramsPop);
|
$paramsPop = str_replace('#type#', $type, $paramsPop);
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new User($userInfo->id);
|
||||||
|
|
||||||
$pl_sess = $this->pl_sess;
|
$pl_sess = $this->pl_sess;
|
||||||
|
|
||||||
if($type === "au") {
|
if($type === "au") {
|
||||||
|
|
||||||
if(isset($pl_sess->id)) {
|
if(isset($pl_sess->id)) {
|
||||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/add-item'.$params, 'callback' => 'window["setSPLContent"]'),
|
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/add-item'.$params, 'callback' => 'window["setSPLContent"]'),
|
||||||
'title' => 'Add to Playlist');
|
'title' => 'Add to Playlist');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,13 +84,16 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$file_id = $this->_getParam('id', null);
|
$file_id = $this->_getParam('id', null);
|
||||||
$file = StoredFile::Recall($file_id);
|
$file = StoredFile::Recall($file_id);
|
||||||
|
|
||||||
$url = $file->getFileURL().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
$url = $file->getRelativeFileUrl($baseUrl).'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
||||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||||
'title' => 'Download');
|
'title' => 'Download');
|
||||||
|
|
||||||
$menu[] = array('action' => array('type' => 'fn',
|
|
||||||
'callback' => "window['confirmDeleteAudioClip']('$paramsPop')"),
|
if ($user->isAdmin()) {
|
||||||
'title' => 'Delete');
|
$menu[] = array('action' => array('type' => 'fn',
|
||||||
|
'callback' => "window['confirmDeleteAudioClip']('$paramsPop')"),
|
||||||
|
'title' => 'Delete');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if($type === "pl") {
|
else if($type === "pl") {
|
||||||
|
|
||||||
|
@ -118,28 +127,38 @@ class LibraryController extends Zend_Controller_Action
|
||||||
public function deleteAction()
|
public function deleteAction()
|
||||||
{
|
{
|
||||||
$id = $this->_getParam('id');
|
$id = $this->_getParam('id');
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new User($userInfo->id);
|
||||||
|
|
||||||
if (!is_null($id)) {
|
if ($user->isAdmin()) {
|
||||||
$file = StoredFile::Recall($id);
|
|
||||||
|
|
||||||
if (PEAR::isError($file)) {
|
if (!is_null($id)) {
|
||||||
$this->view->message = $file->getMessage();
|
$file = StoredFile::Recall($id);
|
||||||
return;
|
|
||||||
}
|
if (PEAR::isError($file)) {
|
||||||
else if(is_null($file)) {
|
$this->view->message = $file->getMessage();
|
||||||
$this->view->message = "file doesn't exist";
|
return;
|
||||||
return;
|
}
|
||||||
|
else if(is_null($file)) {
|
||||||
|
$this->view->message = "file doesn't exist";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $file->delete();
|
||||||
|
|
||||||
|
if (PEAR::isError($res)) {
|
||||||
|
$this->view->message = $res->getMessage();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$res = settype($res, "integer");
|
||||||
|
$data = array("filepath" => $file->getFilePath(), "delete" => $res);
|
||||||
|
RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $file->delete();
|
$this->view->id = $id;
|
||||||
|
|
||||||
if (PEAR::isError($res)) {
|
|
||||||
$this->view->message = $res->getMessage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->id = $id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function contentsAction()
|
public function contentsAction()
|
||||||
|
@ -147,6 +166,12 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$post = $this->getRequest()->getPost();
|
$post = $this->getRequest()->getPost();
|
||||||
$datatables = StoredFile::searchFilesForPlaylistBuilder($post);
|
$datatables = StoredFile::searchFilesForPlaylistBuilder($post);
|
||||||
|
|
||||||
|
//format clip lengh to 1 decimal
|
||||||
|
foreach($datatables["aaData"] as &$data){
|
||||||
|
$sec = Playlist::playlistTimeToSeconds($data[5]);
|
||||||
|
$data[5] = Playlist::secondsToPlaylistTime($sec);
|
||||||
|
}
|
||||||
|
|
||||||
die(json_encode($datatables));
|
die(json_encode($datatables));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,18 +187,17 @@ class LibraryController extends Zend_Controller_Action
|
||||||
if ($form->isValid($request->getPost())) {
|
if ($form->isValid($request->getPost())) {
|
||||||
|
|
||||||
$formdata = $form->getValues();
|
$formdata = $form->getValues();
|
||||||
$file->replaceDbMetadata($formdata);
|
$file->setDbColMetadata($formdata);
|
||||||
|
|
||||||
$data = $formdata;
|
$data = $file->getMetadata();
|
||||||
$data['filepath'] = $file->getRealFilePath();
|
|
||||||
//wait for 1.9.0 release
|
RabbitMq::SendMessageToMediaMonitor("md_update", $data);
|
||||||
//RabbitMq::SendFileMetaData($data);
|
|
||||||
|
|
||||||
$this->_helper->redirector('index');
|
$this->_helper->redirector('index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$form->populate($file->md);
|
$form->populate($file->getDbColMetadata());
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +209,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
if($type == "au") {
|
if($type == "au") {
|
||||||
$file = StoredFile::Recall($id);
|
$file = StoredFile::Recall($id);
|
||||||
$this->view->type = $type;
|
$this->view->type = $type;
|
||||||
$this->view->md = $file->md;
|
$this->view->md = $file->getMetadata();
|
||||||
}
|
}
|
||||||
else if($type == "pl") {
|
else if($type == "pl") {
|
||||||
$file = Playlist::Recall($id);
|
$file = Playlist::Recall($id);
|
||||||
|
@ -195,25 +219,4 @@ class LibraryController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,10 @@ class LoginController extends Zend_Controller_Action
|
||||||
//the default storage is a session with namespace Zend_Auth
|
//the default storage is a session with namespace Zend_Auth
|
||||||
$authStorage = $auth->getStorage();
|
$authStorage = $auth->getStorage();
|
||||||
$authStorage->write($userInfo);
|
$authStorage->write($userInfo);
|
||||||
|
|
||||||
|
$tempSess = new Zend_Session_Namespace("referrer");
|
||||||
|
$tempSess->referrer = 'login';
|
||||||
|
|
||||||
$this->_redirect('Nowplaying');
|
$this->_redirect('Nowplaying');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,6 +7,8 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
$ajaxContext->addActionContext('get-data-grid-data', 'json')
|
$ajaxContext->addActionContext('get-data-grid-data', 'json')
|
||||||
|
->addActionContext('register', 'json')
|
||||||
|
->addActionContext('remindme', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +20,62 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript');
|
||||||
|
|
||||||
|
$refer_sses = new Zend_Session_Namespace('referrer');
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new User($userInfo->id);
|
||||||
|
|
||||||
|
if ($request->isPost()) {
|
||||||
|
$form = new Application_Form_RegisterAirtime();
|
||||||
|
|
||||||
|
$values = $request->getPost();
|
||||||
|
if ($values["Publicise"] != 1){
|
||||||
|
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||||
|
// unset session
|
||||||
|
Zend_Session::namespaceUnset('referrer');
|
||||||
|
}
|
||||||
|
else if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||||
|
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||||
|
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||||
|
Application_Model_Preference::SetEmail($values["Email"]);
|
||||||
|
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||||
|
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::SetSupportFeedback($values["SupportFeedback"]);
|
||||||
|
// unset session
|
||||||
|
Zend_Session::namespaceUnset('referrer');
|
||||||
|
}else{
|
||||||
|
var_dump($form->getMessages());
|
||||||
|
$logo = Application_Model_Preference::GetStationLogo();
|
||||||
|
if($logo){
|
||||||
|
$this->view->logoImg = $logo;
|
||||||
|
}
|
||||||
|
$this->view->dialog = $form;
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//popup if previous page was login
|
||||||
|
if($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp()
|
||||||
|
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||||
|
|
||||||
|
$form = new Application_Form_RegisterAirtime();
|
||||||
|
|
||||||
|
|
||||||
|
$logo = Application_Model_Preference::GetStationLogo();
|
||||||
|
if($logo){
|
||||||
|
$this->view->logoImg = $logo;
|
||||||
|
}
|
||||||
|
$this->view->dialog = $form;
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDataGridDataAction()
|
public function getDataGridDataAction()
|
||||||
|
@ -43,6 +101,22 @@ class NowplayingController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function remindmeAction()
|
||||||
|
{
|
||||||
|
// unset session
|
||||||
|
Zend_Session::namespaceUnset('referrer');
|
||||||
|
$now = date("Y-m-d H:i:s");
|
||||||
|
Application_Model_Preference::SetRemindMeDate($now);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function donotshowregistrationpopupAction()
|
||||||
|
{
|
||||||
|
// unset session
|
||||||
|
Zend_Session::namespaceUnset('referrer');
|
||||||
|
die();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,8 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$this->changePlaylist($pl_id);
|
$this->changePlaylist($pl_id);
|
||||||
|
|
||||||
$pl = $this->getPlaylist();
|
$pl = $this->getPlaylist();
|
||||||
$title = $pl->getPLMetaData(UI_MDATA_KEY_TITLE);
|
$title = $pl->getPLMetaData("dc:title");
|
||||||
$desc = $pl->getPLMetaData(UI_MDATA_KEY_DESCRIPTION);
|
$desc = $pl->getPLMetaData("dc:description");
|
||||||
|
|
||||||
$data = array( 'title' => $title, 'description' => $desc);
|
$data = array( 'title' => $title, 'description' => $desc);
|
||||||
$form->populate($data);
|
$form->populate($data);
|
||||||
|
@ -130,7 +130,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$pl->setName($title);
|
$pl->setName($title);
|
||||||
|
|
||||||
if(isset($description)) {
|
if(isset($description)) {
|
||||||
$pl->setPLMetaData(UI_MDATA_KEY_DESCRIPTION, $description);
|
$pl->setPLMetaData("dc:description", $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->pl = $pl;
|
$this->view->pl = $pl;
|
||||||
|
|
|
@ -7,6 +7,7 @@ class PluploadController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
$ajaxContext->addActionContext('upload', 'json')
|
$ajaxContext->addActionContext('upload', 'json')
|
||||||
|
->addActionContext('copyfile', 'json')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +26,17 @@ 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";
|
||||||
$file = StoredFile::uploadFile($upload_dir);
|
StoredFile::uploadFile($upload_dir);
|
||||||
|
|
||||||
die('{"jsonrpc" : "2.0", "id" : '.$file->getId().' }');
|
die('{"jsonrpc" : "2.0"}');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function copyfileAction(){
|
||||||
|
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||||
|
$filename = $this->_getParam('name');
|
||||||
|
StoredFile::copyFileToStor($upload_dir, $filename);
|
||||||
|
|
||||||
|
die('{"jsonrpc" : "2.0"}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,15 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
/* Initialize action controller here */
|
/* Initialize action controller here */
|
||||||
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
|
$ajaxContext/*->addActionContext('register', 'json')
|
||||||
|
->addActionContext('remindme', 'json')*/
|
||||||
|
->addActionContext('server-browse', 'json')
|
||||||
|
->addActionContext('change-stor-directory', 'json')
|
||||||
|
->addActionContext('reload-watch-directory', 'json')
|
||||||
|
->addActionContext('remove-watch-directory', 'json')
|
||||||
|
->addActionContext('is-import-in-progress', 'json')
|
||||||
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
|
@ -15,34 +24,149 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
|
||||||
$this->view->statusMsg = "";
|
$this->view->statusMsg = "";
|
||||||
|
|
||||||
$form = new Application_Form_Preferences();
|
|
||||||
|
|
||||||
if ($request->isPost()) {
|
|
||||||
|
|
||||||
if ($form->isValid($request->getPost())) {
|
|
||||||
|
|
||||||
|
$form = new Application_Form_Preferences();
|
||||||
|
|
||||||
|
if ($request->isPost()) {
|
||||||
|
if ($form->isValid($request->getPost())) {
|
||||||
$values = $form->getValues();
|
$values = $form->getValues();
|
||||||
|
|
||||||
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
|
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
|
||||||
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::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]);
|
Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||||
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"]);
|
||||||
Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]);
|
Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]);
|
||||||
Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]);
|
Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]);
|
||||||
Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]);
|
|
||||||
|
Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]);
|
||||||
|
|
||||||
|
Application_Model_Preference::SetPhone($values["preferences_support"]["Phone"]);
|
||||||
|
Application_Model_Preference::SetEmail($values["preferences_support"]["Email"]);
|
||||||
|
Application_Model_Preference::SetStationWebSite($values["preferences_support"]["StationWebSite"]);
|
||||||
|
Application_Model_Preference::SetSupportFeedback($values["preferences_support"]["SupportFeedback"]);
|
||||||
|
Application_Model_Preference::SetPublicise($values["preferences_support"]["Publicise"]);
|
||||||
|
|
||||||
|
$form->getSubForm('preferences_support')->Logo->receive();
|
||||||
|
$imagePath = $form->getSubForm('preferences_support')->Logo->getFileName();
|
||||||
|
|
||||||
|
Application_Model_Preference::SetStationCountry($values["preferences_support"]["Country"]);
|
||||||
|
Application_Model_Preference::SetStationCity($values["preferences_support"]["City"]);
|
||||||
|
Application_Model_Preference::SetStationDescription($values["preferences_support"]["Description"]);
|
||||||
|
Application_Model_Preference::SetStationLogo($imagePath);
|
||||||
|
|
||||||
$this->view->statusMsg = "<div class='success'>Preferences updated.</div>";
|
$this->view->statusMsg = "<div class='success'>Preferences updated.</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$logo = Application_Model_Preference::GetStationLogo();
|
||||||
|
if($logo){
|
||||||
|
$this->view->logoImg = $logo;
|
||||||
|
}
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function directoryConfigAction()
|
||||||
|
{
|
||||||
|
$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 serverBrowseAction()
|
||||||
|
{
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$path = $request->getParam("path", null);
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
if(is_null($path))
|
||||||
|
{
|
||||||
|
$element = array();
|
||||||
|
$element["name"] = "path should be specified";
|
||||||
|
$element["isFolder"] = false;
|
||||||
|
$element["isError"] = true;
|
||||||
|
$result[$path] = $element;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$path = $path.'/';
|
||||||
|
$handle = opendir($path);
|
||||||
|
while (false !== ($file = readdir($handle))) {
|
||||||
|
if ($file != "." && $file != "..") {
|
||||||
|
//only show directories that aren't private.
|
||||||
|
if (is_dir($path.$file) && substr($file, 0, 1) != ".") {
|
||||||
|
$element = array();
|
||||||
|
$element["name"] = $file;
|
||||||
|
$element["isFolder"] = true;
|
||||||
|
$element["isError"] = false;
|
||||||
|
$result[$file] = $element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ksort($result);
|
||||||
|
//returns format serverBrowse is looking for.
|
||||||
|
die(json_encode($result));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changeStorDirectoryAction()
|
||||||
|
{
|
||||||
|
$chosen = $this->getRequest()->getParam("dir");
|
||||||
|
$element = $this->getRequest()->getParam("element");
|
||||||
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
|
|
||||||
|
$res = MusicDir::setStorDir($chosen);
|
||||||
|
if($res['code'] != 0){
|
||||||
|
$watched_dirs_form->populate(array('storageFolder' => $chosen));
|
||||||
|
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->view->subform = $watched_dirs_form->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reloadWatchDirectoryAction()
|
||||||
|
{
|
||||||
|
$chosen = $this->getRequest()->getParam("dir");
|
||||||
|
$element = $this->getRequest()->getParam("element");
|
||||||
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
|
|
||||||
|
$res = MusicDir::addWatchedDir($chosen);
|
||||||
|
if($res['code'] != 0){
|
||||||
|
$watched_dirs_form->populate(array('watchedFolder' => $chosen));
|
||||||
|
$watched_dirs_form->getElement($element)->setErrors(array($res['error']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->view->subform = $watched_dirs_form->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeWatchDirectoryAction()
|
||||||
|
{
|
||||||
|
$chosen = $this->getRequest()->getParam("dir");
|
||||||
|
|
||||||
|
$dir = MusicDir::removeWatchedDir($chosen);
|
||||||
|
|
||||||
|
$watched_dirs_form = new Application_Form_WatchedDirPreferences();
|
||||||
|
$this->view->subform = $watched_dirs_form->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isImportInProgressAction(){
|
||||||
|
$now = time();
|
||||||
|
$res = false;
|
||||||
|
if(Application_Model_Preference::GetImportTimestamp()+10 > $now){
|
||||||
|
$res = true;
|
||||||
|
}
|
||||||
|
die(json_encode($res));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ 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 User($userInfo->id);
|
||||||
$this->view->isAdmin = $user->isAdmin();
|
$this->view->isAdmin = $user->isAdmin();
|
||||||
|
$this->view->isProgramManager = $user->isUserType('P');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eventFeedAction()
|
public function eventFeedAction()
|
||||||
|
@ -68,7 +69,7 @@ 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 User($userInfo->id);
|
||||||
if($user->isAdmin())
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)))
|
||||||
$editable = true;
|
$editable = true;
|
||||||
else
|
else
|
||||||
$editable = false;
|
$editable = false;
|
||||||
|
@ -85,7 +86,7 @@ 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 User($userInfo->id);
|
||||||
|
|
||||||
if($user->isAdmin()) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new ShowInstance($showInstanceId);
|
||||||
$error = $show->moveShow($deltaDay, $deltaMin);
|
$error = $show->moveShow($deltaDay, $deltaMin);
|
||||||
}
|
}
|
||||||
|
@ -104,7 +105,7 @@ 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 User($userInfo->id);
|
||||||
|
|
||||||
if($user->isAdmin()) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new ShowInstance($showInstanceId);
|
||||||
$error = $show->resizeShow($deltaDay, $deltaMin);
|
$error = $show->resizeShow($deltaDay, $deltaMin);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@ 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 User($userInfo->id);
|
||||||
|
|
||||||
if($user->isAdmin()) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new ShowInstance($showInstanceId);
|
||||||
$show->deleteShow();
|
$show->deleteShow();
|
||||||
}
|
}
|
||||||
|
@ -155,7 +156,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$soundcloud = new ATSoundcloud();
|
$soundcloud = new ATSoundcloud();
|
||||||
$soundcloud_id = $soundcloud->uploadTrack($file->getRealFilePath(), $file->getName(), $description, $tags, $show_start_time, $show_genre);
|
$soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $file->getName(), $description, $tags, $show_start_time, $show_genre);
|
||||||
$show_inst->setSoundCloudFileId($soundcloud_id);
|
$show_inst->setSoundCloudFileId($soundcloud_id);
|
||||||
$this->view->soundcloud_id = $soundcloud_id;
|
$this->view->soundcloud_id = $soundcloud_id;
|
||||||
break;
|
break;
|
||||||
|
@ -182,10 +183,10 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$show = new ShowInstance($id);
|
$show = new ShowInstance($id);
|
||||||
|
|
||||||
$params = '/format/json/id/#id#';
|
$params = '/format/json/id/#id#';
|
||||||
|
|
||||||
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
|
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
|
||||||
|
|
||||||
if (($user->isHost($show->getShowId()) || $user->isAdmin()) && !$show->isRecorded() && !$show->isRebroadcast()) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()) && !$show->isRecorded() && !$show->isRebroadcast()) {
|
||||||
|
|
||||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params,
|
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params,
|
||||||
'callback' => 'window["buildScheduleDialog"]'), 'title' => 'Add / Remove Content');
|
'callback' => 'window["buildScheduleDialog"]'), 'title' => 'Add / Remove Content');
|
||||||
|
@ -213,7 +214,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) &&
|
if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) &&
|
||||||
strtotime($today_timestamp) < strtotime($show->getShowEnd()) &&
|
strtotime($today_timestamp) < strtotime($show->getShowEnd()) &&
|
||||||
$user->isAdmin()) {
|
$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');
|
||||||
|
@ -221,7 +222,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
|
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
|
||||||
|
|
||||||
if ($user->isAdmin()) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
|
|
||||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/edit-show/format/json/id/'.$id,
|
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/edit-show/format/json/id/'.$id,
|
||||||
'callback' => 'window["beginEditShow"]'), 'title' => 'Edit Show');
|
'callback' => 'window["beginEditShow"]'), 'title' => 'Edit Show');
|
||||||
|
@ -231,7 +232,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance and All Following');
|
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance and All Following');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns format jjmenu is looking for.
|
//returns format jjmenu is looking for.
|
||||||
die(json_encode($menu));
|
die(json_encode($menu));
|
||||||
}
|
}
|
||||||
|
@ -250,7 +251,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$user = new User($userInfo->id);
|
$user = new User($userInfo->id);
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new ShowInstance($showInstanceId);
|
||||||
|
|
||||||
if($user->isHost($show->getShowId()) || $user->isAdmin()) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
||||||
$show->scheduleShow(array($plId));
|
$show->scheduleShow(array($plId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +270,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$user = new User($userInfo->id);
|
$user = new User($userInfo->id);
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new ShowInstance($showInstanceId);
|
||||||
|
|
||||||
if($user->isHost($show->getShowId()) || $user->isAdmin())
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId()))
|
||||||
$show->clearShow();
|
$show->clearShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,6 +285,11 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$show = new ShowInstance($this->sched_sess->showInstanceId);
|
$show = new ShowInstance($this->sched_sess->showInstanceId);
|
||||||
$playlists = $show->searchPlaylistsForShow($post);
|
$playlists = $show->searchPlaylistsForShow($post);
|
||||||
|
foreach( $playlists['aaData'] as &$data){
|
||||||
|
// calling two functions to format time to 1 decimal place
|
||||||
|
$sec = Playlist::playlistTimeToSeconds($data[4]);
|
||||||
|
$data[4] = Playlist::secondsToPlaylistTime($sec);
|
||||||
|
}
|
||||||
|
|
||||||
//for datatables
|
//for datatables
|
||||||
die(json_encode($playlists));
|
die(json_encode($playlists));
|
||||||
|
@ -299,7 +305,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$user = new User($userInfo->id);
|
$user = new User($userInfo->id);
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new ShowInstance($showInstanceId);
|
||||||
|
|
||||||
if($user->isHost($show->getShowId()) || $user->isAdmin()) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
|
||||||
$show->removeGroupFromShow($group_id);
|
$show->removeGroupFromShow($group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +383,7 @@ 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 User($userInfo->id);
|
||||||
if(!$user->isAdmin()) {
|
if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +428,9 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$formWhen->populate(array('add_show_start_date' => $show->getStartDate(),
|
$formWhen->populate(array('add_show_start_date' => $show->getStartDate(),
|
||||||
'add_show_start_time' => DateHelper::removeSecondsFromTime($show->getStartTime()),
|
'add_show_start_time' => DateHelper::removeSecondsFromTime($show->getStartTime()),
|
||||||
'add_show_duration' => $show->getDuration(),
|
'add_show_end_date_no_repeat' => $show->getEndDate(),
|
||||||
|
'add_show_end_time' => DateHelper::removeSecondsFromTime($show->getEndTime()),
|
||||||
|
'add_show_duration' => $show->getDuration(true),
|
||||||
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
||||||
|
|
||||||
if ($show->isStartDateTimeInPast()){
|
if ($show->isStartDateTimeInPast()){
|
||||||
|
@ -541,6 +549,29 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$when = $formWhen->checkReliantFields($data, $startDateModified);
|
$when = $formWhen->checkReliantFields($data, $startDateModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//The way the following code works is that is parses the hour and
|
||||||
|
//minute from a string with the format "1h 20m" or "2h" or "36m".
|
||||||
|
//So we are detecting whether an hour or minute value exists via strpos
|
||||||
|
//and then parse appropriately. A better way to do this in the future is
|
||||||
|
//actually pass the format from javascript in the format hh:mm so we don't
|
||||||
|
//have to do this extra String parsing.
|
||||||
|
$hPos = strpos($data["add_show_duration"], 'h');
|
||||||
|
$mPos = strpos($data["add_show_duration"], 'm');
|
||||||
|
|
||||||
|
$hValue = 0;
|
||||||
|
$mValue = 0;
|
||||||
|
|
||||||
|
if($hPos !== false){
|
||||||
|
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||||
|
}
|
||||||
|
if($mPos !== false){
|
||||||
|
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
||||||
|
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||||
|
|
||||||
if($data["add_show_repeats"]) {
|
if($data["add_show_repeats"]) {
|
||||||
$repeats = $formRepeats->isValid($data);
|
$repeats = $formRepeats->isValid($data);
|
||||||
if($repeats) {
|
if($repeats) {
|
||||||
|
@ -597,7 +628,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) {
|
if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) {
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
$user = new User($userInfo->id);
|
$user = new User($userInfo->id);
|
||||||
if ($user->isAdmin()) {
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
Show::create($data);
|
Show::create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +666,7 @@ 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 User($userInfo->id);
|
||||||
|
|
||||||
if($user->isAdmin()) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
|
||||||
$showInstance = new ShowInstance($showInstanceId);
|
$showInstance = new ShowInstance($showInstanceId);
|
||||||
|
@ -650,7 +681,7 @@ 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 User($userInfo->id);
|
||||||
|
|
||||||
if($user->isAdmin()) {
|
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
$showInstanceId = $this->_getParam('id');
|
$showInstanceId = $this->_getParam('id');
|
||||||
$show = new ShowInstance($showInstanceId);
|
$show = new ShowInstance($showInstanceId);
|
||||||
$show->clearShow();
|
$show->clearShow();
|
||||||
|
|
|
@ -5,50 +5,78 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
// Add start date element
|
||||||
|
$startDate = new Zend_Form_Element_Text('add_show_start_date');
|
||||||
|
$startDate->class = 'input_text';
|
||||||
|
$startDate->setRequired(true)
|
||||||
|
->setLabel('Date/Time Start:')
|
||||||
|
->setValue(date("Y-m-d"))
|
||||||
|
->setFilters(array('StringTrim'))
|
||||||
|
->setValidators(array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('YYYY-MM-DD'))))
|
||||||
|
->setDecorators(array(
|
||||||
|
array(array('open'=>'HtmlTag'), array('tag' => 'dd', 'openOnly'=>true)),
|
||||||
|
'ViewHelper',
|
||||||
|
'Description',
|
||||||
|
array('Label', array('tag' =>'dt'))));
|
||||||
|
$this->addElement($startDate);
|
||||||
|
|
||||||
|
// Add start time element
|
||||||
|
$startTime = new Zend_Form_Element_Text('add_show_start_time');
|
||||||
|
$startTime->class = 'input_text';
|
||||||
|
$startTime->setRequired(true)
|
||||||
|
->setValue('00:00')
|
||||||
|
->setFilters(array('StringTrim'))
|
||||||
|
->setValidators(array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('HH:mm')),
|
||||||
|
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||||
|
->setDecorators(array(
|
||||||
|
'ViewHelper',
|
||||||
|
'Errors',
|
||||||
|
array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true))));
|
||||||
|
$this->addElement($startTime);
|
||||||
|
|
||||||
//$this->setDisableLoadDefaultDecorators(true);
|
// Add end date element
|
||||||
//$this->removeDecorator('DtDdWrapper');
|
$endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat');
|
||||||
|
$endDate->class = 'input_text';
|
||||||
// Add start date element
|
$endDate->setRequired(true)
|
||||||
$this->addElement('text', 'add_show_start_date', array(
|
->setLabel('Date/Time End:')
|
||||||
'label' => 'Date Start:',
|
->setValue(date("Y-m-d"))
|
||||||
'class' => 'input_text',
|
->setFilters(array('StringTrim'))
|
||||||
'required' => true,
|
->setValidators(array(
|
||||||
'value' => date("Y-m-d"),
|
'NotEmpty',
|
||||||
'filters' => array('StringTrim'),
|
array('date', false, array('YYYY-MM-DD'))))
|
||||||
'validators' => array(
|
->setDecorators(array(
|
||||||
'NotEmpty',
|
array(array('open'=>'HtmlTag'), array('tag' => 'dd', 'openOnly'=>true)),
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
'ViewHelper',
|
||||||
)
|
'Description',
|
||||||
));
|
array('Label', array('tag' =>'dt'))));
|
||||||
|
$this->addElement($endDate);
|
||||||
// Add start time element
|
|
||||||
$this->addElement('text', 'add_show_start_time', array(
|
// Add end time element
|
||||||
'label' => 'Start Time:',
|
$endTime = new Zend_Form_Element_Text('add_show_end_time');
|
||||||
'class' => 'input_text',
|
$endTime->class = 'input_text';
|
||||||
'required' => true,
|
$endTime->setRequired(true)
|
||||||
'value' => '0:00',
|
->setValue('01:00')
|
||||||
'filters' => array('StringTrim'),
|
->setFilters(array('StringTrim'))
|
||||||
'validators' => array(
|
->setValidators(array(
|
||||||
'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(
|
||||||
));
|
'ViewHelper',
|
||||||
|
'Errors',
|
||||||
// Add duration element
|
array(array('close'=>'HtmlTag'), array('tag' => 'dd', 'closeOnly'=>true))));
|
||||||
|
$this->addElement($endTime);
|
||||||
|
|
||||||
|
// Add duration element
|
||||||
$this->addElement('text', 'add_show_duration', array(
|
$this->addElement('text', 'add_show_duration', array(
|
||||||
'label' => 'Duration:',
|
'label' => 'Duration:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'value' => '1:00',
|
'value' => '01h00m',
|
||||||
'required' => true,
|
'readonly' => true
|
||||||
'filters' => array('StringTrim'),
|
|
||||||
'validators' => array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('regex', false,
|
|
||||||
array('/^\d+:[0-5][0-9]$/',
|
|
||||||
'messages' => 'enter a duration: HH:mm'))
|
|
||||||
)
|
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add repeats element
|
// Add repeats element
|
||||||
|
@ -69,15 +97,22 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$now_epoch = strtotime($now_timestamp);
|
$now_epoch = strtotime($now_timestamp);
|
||||||
$start_epoch = strtotime($start_timestamp);
|
$start_epoch = strtotime($start_timestamp);
|
||||||
|
|
||||||
if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){
|
|
||||||
if($start_epoch < $now_epoch) {
|
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
|
||||||
$valid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strtotime("00:00") == strtotime($formData["add_show_duration"])) {
|
if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){
|
||||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00:00'));
|
if($start_epoch < $now_epoch) {
|
||||||
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
||||||
|
$valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $formData["add_show_duration"] == "0m" ) {
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 0m'));
|
||||||
|
$valid = false;
|
||||||
|
}elseif(strpos($formData["add_show_duration"], 'h') !== false && intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))) > 24) {
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h'));
|
||||||
|
$valid = false;
|
||||||
|
}elseif( strstr($formData["add_show_duration"], '-') ){
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
|
||||||
|
|
||||||
//Add hosts selection
|
//Add hosts selection
|
||||||
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
|
||||||
$hosts->setLabel('Hosts:')
|
$hosts->setLabel('DJs:')
|
||||||
->setMultiOptions($options);
|
->setMultiOptions($options);
|
||||||
|
|
||||||
$this->addElement($hosts);
|
$this->addElement($hosts);
|
||||||
|
|
|
@ -73,7 +73,8 @@ class Application_Form_AddUser extends Zend_Form
|
||||||
$select->setAttrib('style', 'width: 40%');
|
$select->setAttrib('style', 'width: 40%');
|
||||||
$select->setMultiOptions(array(
|
$select->setMultiOptions(array(
|
||||||
"G" => "Guest",
|
"G" => "Guest",
|
||||||
"H" => "Host",
|
"H" => "DJ",
|
||||||
|
"P" => "Program Manager",
|
||||||
"A" => "Admin"
|
"A" => "Admin"
|
||||||
));
|
));
|
||||||
$select->setRequired(true);
|
$select->setRequired(true);
|
||||||
|
|
|
@ -101,34 +101,41 @@ class Application_Form_EditAudioMD extends Zend_Form
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add mood field
|
// Add bmp field
|
||||||
$this->addElement('text', 'bpm', array(
|
$this->addElement('text', 'bpm', array(
|
||||||
'label' => 'BPM:',
|
'label' => 'BPM:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add mood field
|
// Add copyright field
|
||||||
$this->addElement('text', 'copyright', array(
|
$this->addElement('text', 'copyright', array(
|
||||||
'label' => 'Copyright:',
|
'label' => 'Copyright:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add mood field
|
// Add isrc number field
|
||||||
$this->addElement('text', 'isrc_number', array(
|
$this->addElement('text', 'isrc_number', array(
|
||||||
'label' => 'ISRC Number:',
|
'label' => 'ISRC Number:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add mood field
|
// Add website field
|
||||||
$this->addElement('text', 'info_url', array(
|
$this->addElement('text', 'info_url', array(
|
||||||
'label' => 'Website:',
|
'label' => 'Website:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'filters' => array('StringTrim')
|
'filters' => array('StringTrim')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Add language field
|
||||||
|
$this->addElement('text', 'language', array(
|
||||||
|
'label' => 'Language:',
|
||||||
|
'class' => 'input_text',
|
||||||
|
'filters' => array('StringTrim')
|
||||||
|
));
|
||||||
|
|
||||||
// Add the submit button
|
// Add the submit button
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
//Station name
|
//Station name
|
||||||
$this->addElement('text', 'stationName', array(
|
$this->addElement('text', 'stationName', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Station Name:',
|
'label' => 'Station Name',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array('NotEmpty'),
|
'validators' => array('NotEmpty'),
|
||||||
|
@ -33,15 +33,15 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
'label' => 'Default Fade:',
|
'label' => 'Default Fade:',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(array('regex', false,
|
'validators' => array(array('regex', false,
|
||||||
array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\.\d{1,6})?$/',
|
array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\.\d{1,6})?$/',
|
||||||
'messages' => 'enter a time 00:00:00{.000000}'))),
|
'messages' => 'enter a time 00:00:00{.000000}'))),
|
||||||
'value' => $defaultFade,
|
'value' => $defaultFade,
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
$stream_format = new Zend_Form_Element_Radio('streamFormat');
|
$stream_format = new Zend_Form_Element_Radio('streamFormat');
|
||||||
$stream_format->setLabel('Stream Label:');
|
$stream_format->setLabel('Stream Label:');
|
||||||
$stream_format->setMultiOptions(array("Artist - Title",
|
$stream_format->setMultiOptions(array("Artist - Title",
|
||||||
|
@ -58,6 +58,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
|
||||||
$third_party_api->setDecorators(array('ViewHelper'));
|
$third_party_api->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($third_party_api);
|
$this->addElement($third_party_api);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Application_Form_PlaylistMetadata extends Zend_Form_SubForm
|
class Application_Form_PlaylistMetadata extends Zend_Form{
|
||||||
{
|
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,12 +11,15 @@ class Application_Form_Preferences extends Zend_Form
|
||||||
$this->setDecorators(array(
|
$this->setDecorators(array(
|
||||||
array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
|
array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
|
||||||
));
|
));
|
||||||
|
|
||||||
$general_pref = new Application_Form_GeneralPreferences();
|
$general_pref = new Application_Form_GeneralPreferences();
|
||||||
$this->addSubForm($general_pref, 'preferences_general');
|
$this->addSubForm($general_pref, 'preferences_general');
|
||||||
|
|
||||||
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
|
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
|
||||||
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
|
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
|
||||||
|
|
||||||
|
$support_pref = new Application_Form_SupportPreferences();
|
||||||
|
$this->addSubForm($support_pref, 'preferences_support');
|
||||||
|
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'class' => 'ui-button ui-state-default right-floated',
|
'class' => 'ui-button ui-state-default right-floated',
|
||||||
|
@ -25,6 +28,6 @@ class Application_Form_Preferences extends Zend_Form
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
'ViewHelper'
|
'ViewHelper'
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
147
airtime_mvc/application/forms/RegisterAirtime.php
Normal file
147
airtime_mvc/application/forms/RegisterAirtime.php
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_RegisterAirtime extends Zend_Form
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$this->setAction('/Nowplaying');
|
||||||
|
$this->setMethod('post');
|
||||||
|
|
||||||
|
$country_list = Application_Model_Preference::GetCountryList();
|
||||||
|
|
||||||
|
$this->setDecorators(array(
|
||||||
|
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml')),
|
||||||
|
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
|
||||||
|
);
|
||||||
|
|
||||||
|
// Station Name
|
||||||
|
$stnName = new Zend_Form_Element_Text("stnName");
|
||||||
|
$stnName->setLabel("Station Name")
|
||||||
|
->setRequired(true)
|
||||||
|
->setValue(Application_Model_Preference::GetStationName())
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($stnName);
|
||||||
|
|
||||||
|
// Phone number
|
||||||
|
$this->addElement('text', 'Phone', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'Phone:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => Application_Model_Preference::GetPhone(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
//Email
|
||||||
|
$this->addElement('text', 'Email', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'Email:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => Application_Model_Preference::GetEmail(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Station Web Site
|
||||||
|
$this->addElement('text', 'StationWebSite', array(
|
||||||
|
'label' => 'Station Web Site:',
|
||||||
|
'required' => false,
|
||||||
|
'class' => 'input_text',
|
||||||
|
'value' => Application_Model_Preference::GetStationWebSite(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// county list dropdown
|
||||||
|
$this->addElement('select', 'Country', array(
|
||||||
|
'label' => 'Country:',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetStationCountry(),
|
||||||
|
'multiOptions' => $country_list,
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Station city
|
||||||
|
$this->addElement('text', 'City', array(
|
||||||
|
'label' => 'City:',
|
||||||
|
'required' => false,
|
||||||
|
'class' => 'input_text',
|
||||||
|
'value' => Application_Model_Preference::GetStationCity(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Station Description
|
||||||
|
$description = new Zend_Form_Element_Textarea('Description');
|
||||||
|
$description->class = 'input_text_area';
|
||||||
|
$description->setLabel('Station Description:')
|
||||||
|
->setRequired(false)
|
||||||
|
->setValue(Application_Model_Preference::GetStationDescription())
|
||||||
|
->setDecorators(array('ViewHelper'))
|
||||||
|
->setAttrib('ROWS','2')
|
||||||
|
->setAttrib('COLS','58');
|
||||||
|
$this->addElement($description);
|
||||||
|
|
||||||
|
// Station Logo
|
||||||
|
$upload = new Zend_Form_Element_File('Logo');
|
||||||
|
$upload->setLabel('Station Logo:')
|
||||||
|
->setRequired(false)
|
||||||
|
->setDecorators(array('File'))
|
||||||
|
->addValidator('Count', false, 1)
|
||||||
|
->addValidator('Extension', false, 'jpg,png,gif')
|
||||||
|
->addValidator('ImageSize', false, array(
|
||||||
|
'minwidth' => 200,
|
||||||
|
'minheight' => 200,
|
||||||
|
'maxwidth' => 600,
|
||||||
|
'maxheight' => 600));
|
||||||
|
$this->addElement($upload);
|
||||||
|
|
||||||
|
//enable support feedback
|
||||||
|
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||||
|
'label' => 'Send support feedback',
|
||||||
|
'required' => false,
|
||||||
|
'value' => 1,
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// checkbox for publicise
|
||||||
|
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||||
|
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||||
|
->setRequired(false)
|
||||||
|
->setDecorators(array('ViewHelper'))
|
||||||
|
->setValue(Application_Model_Preference::GetPublicise());
|
||||||
|
$this->addElement($checkboxPublicise);
|
||||||
|
|
||||||
|
// text area for sending detail
|
||||||
|
$this->addElement('textarea', 'SendInfo', array(
|
||||||
|
'class' => 'sending_textarea',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'readonly' => true,
|
||||||
|
'rows' => 5,
|
||||||
|
'cols' => 61,
|
||||||
|
'value' => Application_Model_Preference::GetSystemInfo(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// checkbox for privacy policy
|
||||||
|
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
||||||
|
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($checkboxPrivacy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
151
airtime_mvc/application/forms/SupportPreferences.php
Normal file
151
airtime_mvc/application/forms/SupportPreferences.php
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_SupportPreferences extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$country_list = Application_Model_Preference::GetCountryList();
|
||||||
|
|
||||||
|
$this->setDecorators(array(
|
||||||
|
array('ViewScript', array('viewScript' => 'form/preferences_support.phtml')),
|
||||||
|
array('File', array('viewScript' => 'form/preferences_support.phtml', 'placement' => false)))
|
||||||
|
);
|
||||||
|
|
||||||
|
// Phone number
|
||||||
|
$this->addElement('text', 'Phone', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'Phone:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => Application_Model_Preference::GetPhone(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
//Email
|
||||||
|
$this->addElement('text', 'Email', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'Email:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => Application_Model_Preference::GetEmail(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Station Web Site
|
||||||
|
$this->addElement('text', 'StationWebSite', array(
|
||||||
|
'label' => 'Station Web Site:',
|
||||||
|
'required' => false,
|
||||||
|
'class' => 'input_text',
|
||||||
|
'value' => Application_Model_Preference::GetStationWebSite(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// county list dropdown
|
||||||
|
$this->addElement('select', 'Country', array(
|
||||||
|
'label' => 'Country:',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetStationCountry(),
|
||||||
|
'multiOptions' => $country_list,
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Station city
|
||||||
|
$this->addElement('text', 'City', array(
|
||||||
|
'label' => 'City:',
|
||||||
|
'required' => false,
|
||||||
|
'class' => 'input_text',
|
||||||
|
'value' => Application_Model_Preference::GetStationCity(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Station Description
|
||||||
|
$description = new Zend_Form_Element_Textarea('Description');
|
||||||
|
$description->class = 'input_text_area';
|
||||||
|
$description->setLabel('Station Description:')
|
||||||
|
->setRequired(false)
|
||||||
|
->setValue(Application_Model_Preference::GetStationDescription())
|
||||||
|
->setDecorators(array('ViewHelper'))
|
||||||
|
->setAttrib('ROWS','2')
|
||||||
|
->setAttrib('COLS','58');
|
||||||
|
$this->addElement($description);
|
||||||
|
|
||||||
|
// Station Logo
|
||||||
|
$upload = new Zend_Form_Element_File('Logo');
|
||||||
|
$upload->setLabel('Station Logo:')
|
||||||
|
->setRequired(false)
|
||||||
|
->setDecorators(array('File'))
|
||||||
|
->addValidator('Count', false, 1)
|
||||||
|
->addValidator('Extension', false, 'jpg,png,gif')
|
||||||
|
->addValidator('ImageSize', false, array(
|
||||||
|
'minwidth' => 200,
|
||||||
|
'minheight' => 200,
|
||||||
|
'maxwidth' => 600,
|
||||||
|
'maxheight' => 600));
|
||||||
|
$this->addElement($upload);
|
||||||
|
|
||||||
|
//enable support feedback
|
||||||
|
$this->addElement('checkbox', 'SupportFeedback', array(
|
||||||
|
'label' => 'Send support feedback',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetSupportFeedback(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// checkbox for publicise
|
||||||
|
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
|
||||||
|
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
|
||||||
|
->setRequired(false)
|
||||||
|
->setDecorators(array('ViewHelper'))
|
||||||
|
->setValue(Application_Model_Preference::GetPublicise());
|
||||||
|
if(Application_Model_Preference::GetSupportFeedback() == '0'){
|
||||||
|
$checkboxPublicise->setAttrib("disabled", "disabled");
|
||||||
|
}
|
||||||
|
$this->addElement($checkboxPublicise);
|
||||||
|
|
||||||
|
// text area for sending detail
|
||||||
|
$this->addElement('textarea', 'SendInfo', array(
|
||||||
|
'class' => 'sending_textarea',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'readonly' => true,
|
||||||
|
'cols' => 61,
|
||||||
|
'rows' => 5,
|
||||||
|
'value' => Application_Model_Preference::GetSystemInfo(),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// checkbox for privacy policy
|
||||||
|
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
|
||||||
|
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
|
||||||
|
->setDecorators(array('ViewHelper'));
|
||||||
|
$this->addElement($checkboxPrivacy);
|
||||||
|
}
|
||||||
|
|
||||||
|
// overwriting isValid function
|
||||||
|
public function isValid ($data)
|
||||||
|
{
|
||||||
|
parent::isValid($data);
|
||||||
|
$checkPrivacy = $this->getElement('Privacy');
|
||||||
|
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
|
||||||
|
$checkPrivacy->addError("You have to agree to privacy policy.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
51
airtime_mvc/application/forms/WatchedDirPreferences.php
Normal file
51
airtime_mvc/application/forms/WatchedDirPreferences.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$this->setDecorators(array(
|
||||||
|
array('ViewScript', array('viewScript' => 'form/preferences_watched_dirs.phtml'))
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement('text', 'storageFolder', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'Airtime\'s Storage Folder:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => '',
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addElement('text', 'watchedFolder', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'Choose a Folder to Watch:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => '',
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verifyChosenFolder($p_form_element_id) {
|
||||||
|
|
||||||
|
$element = $this->getElement($p_form_element_id);
|
||||||
|
|
||||||
|
if (!is_dir($element->getValue())) {
|
||||||
|
$element->setErrors(array('Not a valid Directory'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$element->setValue("");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div id="side_playlist" class="ui-widget ui-widget-content block-shadow alpha-block"><?php echo $this->layout()->spl ?></div>
|
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded"><?php echo $this->layout()->library ?></div>
|
||||||
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow omega-block padded"><?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>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -19,6 +19,7 @@ class Application_Model_Dashboard
|
||||||
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||||
"starts"=>$row[0]["starts"],
|
"starts"=>$row[0]["starts"],
|
||||||
"ends"=>$row[0]["ends"]);
|
"ends"=>$row[0]["ends"]);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (count($row) == 0){
|
if (count($row) == 0){
|
||||||
|
@ -57,8 +58,13 @@ class Application_Model_Dashboard
|
||||||
if (count($row) == 0){
|
if (count($row) == 0){
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
//should never reach here. Doesnt make sense to have
|
/* Should never reach here, but lets return the track information
|
||||||
//a schedule item not within a show_instance.
|
* just in case we allow tracks to be scheduled without a show
|
||||||
|
* in the future.
|
||||||
|
*/
|
||||||
|
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
|
||||||
|
"starts"=>$row[0]["starts"],
|
||||||
|
"ends"=>$row[0]["ends"]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (count($row) == 0){
|
if (count($row) == 0){
|
||||||
|
|
|
@ -127,5 +127,35 @@ class DateHelper
|
||||||
$explode = explode(" ", $p_timestamp);
|
$explode = explode(" ", $p_timestamp);
|
||||||
return $explode[1];
|
return $explode[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Given a track length in the format HH:MM:SS.mm, we want to
|
||||||
|
* convert this to seconds. This is useful for Liquidsoap which
|
||||||
|
* likes input parameters give in seconds.
|
||||||
|
* For example, 00:06:31.444, should be converted to 391.444 seconds
|
||||||
|
* @param int $p_time
|
||||||
|
* The time interval in format HH:MM:SS.mm we wish to
|
||||||
|
* convert to seconds.
|
||||||
|
* @return int
|
||||||
|
* The input parameter converted to seconds.
|
||||||
|
*/
|
||||||
|
public static function calculateLengthInSeconds($p_time){
|
||||||
|
|
||||||
|
if (2 !== substr_count($p_time, ":")){
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 === substr_count($p_time, ".")){
|
||||||
|
list($hhmmss, $ms) = explode(".", $p_time);
|
||||||
|
} else {
|
||||||
|
$hhmmss = $p_time;
|
||||||
|
$ms = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
list($hours, $minutes, $seconds) = explode(":", $hhmmss);
|
||||||
|
|
||||||
|
$totalSeconds = $hours*3600 + $minutes*60 + $seconds + $ms/1000;
|
||||||
|
|
||||||
|
return $totalSeconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
312
airtime_mvc/application/models/MusicDir.php
Normal file
312
airtime_mvc/application/models/MusicDir.php
Normal file
|
@ -0,0 +1,312 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class NestedDirectoryException extends Exception { }
|
||||||
|
|
||||||
|
class MusicDir {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @holds propel database object
|
||||||
|
*/
|
||||||
|
private $_dir;
|
||||||
|
|
||||||
|
public function __construct($dir)
|
||||||
|
{
|
||||||
|
$this->_dir = $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->_dir->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getType()
|
||||||
|
{
|
||||||
|
return $this->_dir->getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setType($type)
|
||||||
|
{
|
||||||
|
$this->_dir->setType($type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDirectory()
|
||||||
|
{
|
||||||
|
return $this->_dir->getDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDirectory($dir)
|
||||||
|
{
|
||||||
|
$this->_dir->setDirectory($dir);
|
||||||
|
$this->_dir->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function remove()
|
||||||
|
{
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$music_dir_id = $this->getId();
|
||||||
|
|
||||||
|
$sql = "SELECT DISTINCT s.instance_id from cc_music_dirs as md LEFT JOIN cc_files as f on f.directory = md.id
|
||||||
|
RIGHT JOIN cc_schedule as s on s.file_id = f.id WHERE md.id = $music_dir_id";
|
||||||
|
|
||||||
|
$show_instances = $CC_DBC->GetAll($sql);
|
||||||
|
|
||||||
|
$this->_dir->delete();
|
||||||
|
|
||||||
|
foreach ($show_instances as $show_instance_row) {
|
||||||
|
$temp_show = new ShowInstance($show_instance_row["instance_id"]);
|
||||||
|
$temp_show->updateScheduledTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
RabbitMq::PushSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if p_dir1 is the ancestor of p_dir2. Returns
|
||||||
|
* true if it is the ancestor, false otherwise. Note that
|
||||||
|
* /home/user is considered the ancestor of /home/user
|
||||||
|
*
|
||||||
|
* @param string $p_dir1
|
||||||
|
* The potential ancestor directory.
|
||||||
|
* @param string $p_dir2
|
||||||
|
* The potential descendent directory.
|
||||||
|
* @return boolean
|
||||||
|
* Returns true if it is the ancestor, false otherwise.
|
||||||
|
*/
|
||||||
|
private static function isAncestorDir($p_dir1, $p_dir2){
|
||||||
|
if (strlen($p_dir1) > strlen($p_dir2)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return substr($p_dir2, 0, strlen($p_dir1)) == $p_dir1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the path provided is a valid path. A valid path
|
||||||
|
* is defined as not being nested within an existing watched directory,
|
||||||
|
* or vice-versa. Throws a NestedDirectoryException if invalid.
|
||||||
|
*
|
||||||
|
* @param string $p_path
|
||||||
|
* The path we want to validate
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function isPathValid($p_path){
|
||||||
|
$dirs = self::getWatchedDirs();
|
||||||
|
$dirs[] = self::getStorDir();
|
||||||
|
|
||||||
|
foreach ($dirs as $dirObj){
|
||||||
|
$dir = $dirObj->getDirectory();
|
||||||
|
$diff = strlen($dir) - strlen($p_path);
|
||||||
|
if ($diff == 0){
|
||||||
|
if ($dir == $p_path){
|
||||||
|
throw new NestedDirectoryException("'$p_path' is already watched.");
|
||||||
|
}
|
||||||
|
} else if ($diff > 0){
|
||||||
|
if (self::isAncestorDir($p_path, $dir)){
|
||||||
|
throw new NestedDirectoryException("'$p_path' contains nested watched directory: '$dir'");
|
||||||
|
}
|
||||||
|
} else { /* diff < 0*/
|
||||||
|
if (self::isAncestorDir($dir, $p_path)){
|
||||||
|
throw new NestedDirectoryException("'$p_path' is nested within existing watched directory: '$dir'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addDir($p_path, $p_type)
|
||||||
|
{
|
||||||
|
if(!is_dir($p_path)){
|
||||||
|
return array("code"=>2, "error"=>"'$p_path' is not a valid directory.");
|
||||||
|
}
|
||||||
|
$dir = new CcMusicDirs();
|
||||||
|
$dir->setType($p_type);
|
||||||
|
$p_path = realpath($p_path)."/";
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
/* isPathValid() checks if path is a substring or a superstring of an
|
||||||
|
* existing dir and if not, throws NestedDirectoryException */
|
||||||
|
self::isPathValid($p_path);
|
||||||
|
$dir->setDirectory($p_path);
|
||||||
|
|
||||||
|
$dir->save();
|
||||||
|
return array("code"=>0);
|
||||||
|
} catch (NestedDirectoryException $nde){
|
||||||
|
$msg = $nde->getMessage();
|
||||||
|
return array("code"=>1, "error"=>"$msg");
|
||||||
|
} catch(Exception $e){
|
||||||
|
return array("code"=>1, "error"=>"'$p_path' is already set as the current storage dir or in the watched folders list");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addWatchedDir($p_path)
|
||||||
|
{
|
||||||
|
$res = self::addDir($p_path, "watched");
|
||||||
|
if ($res['code'] == 0){
|
||||||
|
|
||||||
|
//convert "linked" files (Airtime <= 1.8.2) to watched files.
|
||||||
|
$propel_link_dir = CcMusicDirsQuery::create()
|
||||||
|
->filterByType('link')
|
||||||
|
->findOne();
|
||||||
|
|
||||||
|
//see if any linked files exist.
|
||||||
|
if (isset($propel_link_dir)) {
|
||||||
|
|
||||||
|
//newly added watched directory object
|
||||||
|
$propel_new_watch = CcMusicDirsQuery::create()
|
||||||
|
->filterByDirectory(realpath($p_path)."/")
|
||||||
|
->findOne();
|
||||||
|
|
||||||
|
//any files of the deprecated "link" type.
|
||||||
|
$link_files = CcFilesQuery::create()
|
||||||
|
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||||
|
->filterByDbDirectory($propel_link_dir->getId())
|
||||||
|
->find();
|
||||||
|
|
||||||
|
$newly_watched_dir = $propel_new_watch->getDirectory();
|
||||||
|
|
||||||
|
foreach ($link_files as $link_file) {
|
||||||
|
$link_filepath = $link_file->getDbFilepath();
|
||||||
|
|
||||||
|
//convert "link" file into a watched file.
|
||||||
|
if ((strlen($newly_watched_dir) < strlen($link_filepath)) && (substr($link_filepath, 0, strlen($newly_watched_dir)) === $newly_watched_dir)) {
|
||||||
|
|
||||||
|
//get the filepath path not including the watched directory.
|
||||||
|
$sub_link_filepath = substr($link_filepath, strlen($newly_watched_dir));
|
||||||
|
|
||||||
|
$link_file->setDbDirectory($propel_new_watch->getId());
|
||||||
|
$link_file->setDbFilepath($sub_link_filepath);
|
||||||
|
$link_file->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data["directory"] = $p_path;
|
||||||
|
RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDirByPK($pk)
|
||||||
|
{
|
||||||
|
$dir = CcMusicDirsQuery::create()->findPK($pk);
|
||||||
|
|
||||||
|
$mus_dir = new MusicDir($dir);
|
||||||
|
|
||||||
|
return $mus_dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDirByPath($p_path)
|
||||||
|
{
|
||||||
|
$dir = CcMusicDirsQuery::create()
|
||||||
|
->filterByDirectory($p_path)
|
||||||
|
->findOne();
|
||||||
|
|
||||||
|
if($dir == NULL){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$mus_dir = new MusicDir($dir);
|
||||||
|
return $mus_dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getWatchedDirs()
|
||||||
|
{
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
$dirs = CcMusicDirsQuery::create()
|
||||||
|
->filterByType("watched")
|
||||||
|
->find();
|
||||||
|
|
||||||
|
foreach($dirs as $dir) {
|
||||||
|
$tmp = new MusicDir($dir);
|
||||||
|
$result[] = $tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getStorDir()
|
||||||
|
{
|
||||||
|
$dir = CcMusicDirsQuery::create()
|
||||||
|
->filterByType("stor")
|
||||||
|
->findOne();
|
||||||
|
|
||||||
|
$mus_dir = new MusicDir($dir);
|
||||||
|
|
||||||
|
return $mus_dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setStorDir($p_dir)
|
||||||
|
{
|
||||||
|
if(!is_dir($p_dir)){
|
||||||
|
return array("code"=>2, "error"=>"'$p_dir' is not a valid directory.");
|
||||||
|
}else if(Application_Model_Preference::GetImportTimestamp()+10 > time()){
|
||||||
|
return array("code"=>3, "error"=>"Airtime is currently importing files. Please wait until this is complete before changing the storage directory.");
|
||||||
|
}
|
||||||
|
$dir = self::getStorDir();
|
||||||
|
// if $p_dir doesn't exist in DB
|
||||||
|
$p_dir = realpath($p_dir)."/";
|
||||||
|
$exist = $dir->getDirByPath($p_dir);
|
||||||
|
if($exist == NULL){
|
||||||
|
$dir->setDirectory($p_dir);
|
||||||
|
$dirId = $dir->getId();
|
||||||
|
$data = array();
|
||||||
|
$data["directory"] = $p_dir;
|
||||||
|
$data["dir_id"] = $dirId;
|
||||||
|
RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
|
||||||
|
return array("code"=>0);
|
||||||
|
}else{
|
||||||
|
return array("code"=>1, "error"=>"'$p_dir' is already set as the current storage dir or in the watched folders list.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getWatchedDirFromFilepath($p_filepath)
|
||||||
|
{
|
||||||
|
$dirs = CcMusicDirsQuery::create()
|
||||||
|
->filterByType(array("watched", "stor"))
|
||||||
|
->find();
|
||||||
|
|
||||||
|
foreach($dirs as $dir) {
|
||||||
|
$directory = $dir->getDirectory();
|
||||||
|
if (substr($p_filepath, 0, strlen($directory)) === $directory) {
|
||||||
|
$mus_dir = new MusicDir($dir);
|
||||||
|
return $mus_dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function removeWatchedDir($p_dir){
|
||||||
|
$p_dir = realpath($p_dir)."/";
|
||||||
|
$dir = MusicDir::getDirByPath($p_dir);
|
||||||
|
if($dir == NULL){
|
||||||
|
return array("code"=>1,"error"=>"'$p_dir' doesn't exist in the watched list.");
|
||||||
|
}else{
|
||||||
|
$dir->remove();
|
||||||
|
$data = array();
|
||||||
|
$data["directory"] = $p_dir;
|
||||||
|
RabbitMq::SendMessageToMediaMonitor("remove_watch", $data);
|
||||||
|
return array("code"=>0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function splitFilePath($p_filepath)
|
||||||
|
{
|
||||||
|
$mus_dir = self::getWatchedDirFromFilepath($p_filepath);
|
||||||
|
|
||||||
|
if(is_null($mus_dir)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$length_dir = strlen($mus_dir->getDirectory());
|
||||||
|
$fp = substr($p_filepath, $length_dir);
|
||||||
|
|
||||||
|
return array($mus_dir->getDirectory(), $fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,23 +8,28 @@ class Application_Model_Nowplaying
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function CreateDatatableRows($p_dbRows){
|
public static function CreateDatatableRows($p_dbRows){
|
||||||
|
$dataTablesRows = array();
|
||||||
$dataTablesRows = array();
|
|
||||||
|
$date = new DateHelper;
|
||||||
$date = new DateHelper;
|
$timeNow = $date->getTimestamp();
|
||||||
$timeNow = $date->getTimestamp();
|
|
||||||
|
foreach ($p_dbRows as $dbRow){
|
||||||
|
$status = ($dbRow['show_ends'] < $dbRow['item_ends']) ? "x" : "";
|
||||||
foreach ($p_dbRows as $dbRow){
|
|
||||||
$status = ($dbRow['show_ends'] < $dbRow['item_ends']) ? "x" : "";
|
$type = "a";
|
||||||
|
$type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : "";
|
||||||
$type = "a";
|
|
||||||
$type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : "";
|
// remove millisecond from the time format
|
||||||
|
$itemStart = explode('.', $dbRow['item_starts']);
|
||||||
$dataTablesRows[] = array($type, $dbRow['show_starts'], $dbRow['item_starts'], $dbRow['item_ends'],
|
$itemEnd = explode('.', $dbRow['item_ends']);
|
||||||
$dbRow['clip_length'], $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
|
||||||
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
//format duration
|
||||||
}
|
$duration = explode('.', $dbRow['clip_length']);
|
||||||
|
$formated = Application_Model_Nowplaying::FormatDuration($duration[0]);
|
||||||
|
$dataTablesRows[] = array($type, $dbRow['show_starts'], $itemStart[0], $itemEnd[0],
|
||||||
|
$formated, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
||||||
|
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
||||||
|
}
|
||||||
|
|
||||||
return $dataTablesRows;
|
return $dataTablesRows;
|
||||||
}
|
}
|
||||||
|
@ -55,34 +60,81 @@ class Application_Model_Nowplaying
|
||||||
$endCutoff = $date->getNowDayEndDiff();
|
$endCutoff = $date->getNowDayEndDiff();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
$showIds = ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
|
$showIds = ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
|
||||||
foreach ($showIds as $showId){
|
foreach ($showIds as $showId){
|
||||||
$instanceId = $showId['id'];
|
$instanceId = $showId['id'];
|
||||||
|
|
||||||
|
$si = new ShowInstance($instanceId);
|
||||||
|
|
||||||
|
$showId = $si->getShowId();
|
||||||
|
$show = new Show($showId);
|
||||||
|
|
||||||
|
//append show header row
|
||||||
|
$data[] = Application_Model_Nowplaying::CreateHeaderRow($show->getName(), $si->getShowStart(), $si->getShowEnd());
|
||||||
|
|
||||||
|
$scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
|
||||||
|
$dataTablesRows = Application_Model_Nowplaying::CreateDatatableRows($scheduledItems);
|
||||||
|
|
||||||
|
//append show audio item rows
|
||||||
|
$data = array_merge($data, $dataTablesRows);
|
||||||
|
|
||||||
|
//append show gap time row
|
||||||
|
$gapTime = Application_Model_Nowplaying::FormatDuration($si->getShowEndGapTime(), true);
|
||||||
|
if ($si->isRecorded())
|
||||||
|
$data[] = Application_Model_Nowplaying::CreateRecordingRow($si);
|
||||||
|
else if ($gapTime > 0)
|
||||||
|
$data[] = Application_Model_Nowplaying::CreateGapRow($gapTime);
|
||||||
|
}
|
||||||
|
|
||||||
$si = new ShowInstance($instanceId);
|
return array("currentShow"=>Show_DAL::GetCurrentShow($timeNow), "rows"=>$data);
|
||||||
|
}
|
||||||
$showId = $si->getShowId();
|
|
||||||
$show = new Show($showId);
|
public static function ShouldShowPopUp(){
|
||||||
|
$today = mktime(0, 0, 0, date("m") , date("d"), date("Y"));
|
||||||
//append show header row
|
$remindDate = Application_Model_Preference::GetRemindMeDate();
|
||||||
$data[] = Application_Model_Nowplaying::CreateHeaderRow($show->getName(), $si->getShowStart(), $si->getShowEnd());
|
if($remindDate == NULL || $today >= $remindDate){
|
||||||
|
return true;
|
||||||
$scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
|
}
|
||||||
$dataTablesRows = Application_Model_Nowplaying::CreateDatatableRows($scheduledItems);
|
}
|
||||||
|
/*
|
||||||
//append show audio item rows
|
* default $time format should be in format of 00:00:00
|
||||||
$data = array_merge($data, $dataTablesRows);
|
* if $inSecond = true, then $time should be in seconds
|
||||||
|
*/
|
||||||
//append show gap time row
|
public static function FormatDuration($time, $inSecond=false){
|
||||||
$gapTime = $si->getShowEndGapTime();
|
if($inSecond == false){
|
||||||
if ($si->isRecorded())
|
$duration = explode(':', $time);
|
||||||
$data[] = Application_Model_Nowplaying::CreateRecordingRow($si);
|
}else{
|
||||||
else if ($gapTime > 0)
|
$duration = array();
|
||||||
$data[] = Application_Model_Nowplaying::CreateGapRow($gapTime);
|
$duration[0] = intval(($time/3600)%24);
|
||||||
}
|
$duration[1] = intval(($time/60)%60);
|
||||||
|
$duration[2] = $time%60;
|
||||||
return array("currentShow"=>Show_DAL::GetCurrentShow($timeNow), "rows"=>$data);
|
}
|
||||||
}
|
|
||||||
|
if($duration[2] == 0){
|
||||||
|
$duration[2] = '';
|
||||||
|
}else{
|
||||||
|
$duration[2] = intval($duration[2],10).'s';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($duration[1] == 0){
|
||||||
|
if($duration[2] == ''){
|
||||||
|
$duration[1] = '';
|
||||||
|
}else{
|
||||||
|
$duration[1] = intval($duration[1],10).'m ';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$duration[1] = intval($duration[1],10).'m ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($duration[0] == 0){
|
||||||
|
$duration[0] = '';
|
||||||
|
}else{
|
||||||
|
$duration[0] = intval($duration[0],10).'h ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = $duration[0].$duration[1].$duration[2];
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,13 +85,19 @@ class Playlist {
|
||||||
- *
|
- *
|
||||||
- * @param float $seconds
|
- * @param float $seconds
|
||||||
- * @return string
|
- * @return string
|
||||||
- * time in playlist time format (HH:mm:ss.dddddd)
|
- * time in playlist time format (HH:mm:ss.d)
|
||||||
- */
|
- */
|
||||||
public static function secondsToPlaylistTime($p_seconds)
|
public static function secondsToPlaylistTime($p_seconds)
|
||||||
{
|
{
|
||||||
$seconds = $p_seconds;
|
$seconds = $p_seconds;
|
||||||
$milliseconds = intval(($seconds - intval($seconds)) * 1000);
|
$rounded = round($seconds, 1);
|
||||||
$milliStr = str_pad($milliseconds, 6, '0');
|
$info = explode('.', $rounded);
|
||||||
|
$seconds = $info[0];
|
||||||
|
if(!isset($info[1])){
|
||||||
|
$milliStr = 0;
|
||||||
|
}else{
|
||||||
|
$milliStr = $info[1];
|
||||||
|
}
|
||||||
$hours = floor($seconds / 3600);
|
$hours = floor($seconds / 3600);
|
||||||
$seconds -= $hours * 3600;
|
$seconds -= $hours * 3600;
|
||||||
$minutes = floor($seconds / 60);
|
$minutes = floor($seconds / 60);
|
||||||
|
@ -119,6 +125,12 @@ class Playlist {
|
||||||
$sql = 'DELETE FROM '.$CC_CONFIG["playListTable"];
|
$sql = 'DELETE FROM '.$CC_CONFIG["playListTable"];
|
||||||
$CC_DBC->query($sql);
|
$CC_DBC->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getPlaylistCount(){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"];
|
||||||
|
return $CC_DBC->GetOne($sql);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the file from all playlists.
|
* Delete the file from all playlists.
|
||||||
|
@ -388,8 +400,16 @@ class Playlist {
|
||||||
->filterByDbPlaylistId($this->id)
|
->filterByDbPlaylistId($this->id)
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$offset = 0;
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$files[] = $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
|
||||||
|
$clipSec = Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
|
||||||
|
$files[$i]['cliplength'] = Playlist::secondsToPlaylistTime($clipSec);
|
||||||
|
$offset += $clipSec;
|
||||||
|
$files[$i]['offset'] = Playlist::secondsToPlaylistTime($offset);
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $files;
|
return $files;
|
||||||
|
@ -402,7 +422,10 @@ class Playlist {
|
||||||
|
|
||||||
if(is_null($res))
|
if(is_null($res))
|
||||||
return '00:00:00';
|
return '00:00:00';
|
||||||
|
|
||||||
|
// calling two functions to format time to 1 decimal place
|
||||||
|
$sec = Playlist::playlistTimeToSeconds($res);
|
||||||
|
$res = Playlist::secondsToPlaylistTime($sec);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +514,7 @@ class Playlist {
|
||||||
}
|
}
|
||||||
|
|
||||||
$metadata = $media->getMetadata();
|
$metadata = $media->getMetadata();
|
||||||
$length = $metadata["dcterms:extent"];
|
$length = $metadata['MDATA_KEY_DURATION'];
|
||||||
|
|
||||||
if (!is_null($p_clipLength)) {
|
if (!is_null($p_clipLength)) {
|
||||||
$length = $p_clipLength;
|
$length = $p_clipLength;
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Application_Model_Preference
|
||||||
else if(is_null($id)) {
|
else if(is_null($id)) {
|
||||||
$sql = "INSERT INTO cc_pref (keystr, valstr)"
|
$sql = "INSERT INTO cc_pref (keystr, valstr)"
|
||||||
." VALUES ('$key', '$value')";
|
." VALUES ('$key', '$value')";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr)"
|
||||||
." VALUES ($id, '$key', '$value')";
|
." VALUES ($id, '$key', '$value')";
|
||||||
|
@ -189,5 +189,183 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SetPhone($phone){
|
||||||
|
Application_Model_Preference::SetValue("phone", $phone);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetPhone(){
|
||||||
|
return Application_Model_Preference::GetValue("phone");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetEmail($email){
|
||||||
|
Application_Model_Preference::SetValue("email", $email);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetEmail(){
|
||||||
|
return Application_Model_Preference::GetValue("email");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetStationWebSite($site){
|
||||||
|
Application_Model_Preference::SetValue("station_website", $site);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetStationWebSite(){
|
||||||
|
return Application_Model_Preference::GetValue("station_website");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetSupportFeedback($feedback){
|
||||||
|
Application_Model_Preference::SetValue("support_feedback", $feedback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetSupportFeedback(){
|
||||||
|
return Application_Model_Preference::GetValue("support_feedback");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetPublicise($publicise){
|
||||||
|
Application_Model_Preference::SetValue("publicise", $publicise);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetPublicise(){
|
||||||
|
return Application_Model_Preference::GetValue("publicise");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetRegistered($registered){
|
||||||
|
Application_Model_Preference::SetValue("registered", $registered);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetRegistered(){
|
||||||
|
return Application_Model_Preference::GetValue("registered");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetStationCountry($country){
|
||||||
|
Application_Model_Preference::SetValue("country", $country);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetStationCountry(){
|
||||||
|
return Application_Model_Preference::GetValue("country");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetStationCity($city){
|
||||||
|
Application_Model_Preference::SetValue("city", $city);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetStationCity(){
|
||||||
|
return Application_Model_Preference::GetValue("city");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetStationDescription($description){
|
||||||
|
Application_Model_Preference::SetValue("description", $description);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetStationDescription(){
|
||||||
|
return Application_Model_Preference::GetValue("description");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetStationLogo($imagePath){
|
||||||
|
if(!empty($imagePath)){
|
||||||
|
$image = @file_get_contents($imagePath);
|
||||||
|
$image = base64_encode($image);
|
||||||
|
Application_Model_Preference::SetValue("logoImage", $image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetStationLogo(){
|
||||||
|
return Application_Model_Preference::GetValue("logoImage");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetUniqueId(){
|
||||||
|
return Application_Model_Preference::GetValue("uniqueId");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetCountryList(){
|
||||||
|
global $CC_DBC;
|
||||||
|
$sql = "SELECT * FROM cc_country";
|
||||||
|
$res = $CC_DBC->GetAll($sql);
|
||||||
|
$out = array();
|
||||||
|
$out[""] = "Select Country";
|
||||||
|
foreach($res as $r){
|
||||||
|
$out[$r["isocode"]] = $r["name"];
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetSystemInfo($returnArray=false){
|
||||||
|
exec('/usr/bin/airtime-check-system', $output);
|
||||||
|
|
||||||
|
$output = preg_replace('/\s+/', ' ', $output);
|
||||||
|
|
||||||
|
$systemInfoArray = array();
|
||||||
|
foreach( $output as $key => &$out){
|
||||||
|
$info = explode('=', $out);
|
||||||
|
if(isset($info[1])){
|
||||||
|
$key = str_replace(' ', '_', trim($info[0]));
|
||||||
|
$key = strtoupper($key);
|
||||||
|
$systemInfoArray[$key] = $info[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$outputArray = array();
|
||||||
|
|
||||||
|
$outputArray['STATION_NAME'] = Application_Model_Preference::GetStationName();
|
||||||
|
$outputArray['PHONE'] = Application_Model_Preference::GetPhone();
|
||||||
|
$outputArray['EMAIL'] = Application_Model_Preference::GetEmail();
|
||||||
|
$outputArray['STATION_WEB_SITE'] = Application_Model_Preference::GetStationWebSite();
|
||||||
|
$outputArray['STATION_COUNTRY'] = Application_Model_Preference::GetStationCountry();
|
||||||
|
$outputArray['STATION_CITY'] = Application_Model_Preference::GetStationCity();
|
||||||
|
$outputArray['STATION_DESCRIPTION'] = Application_Model_Preference::GetStationDescription();
|
||||||
|
|
||||||
|
// get web server info
|
||||||
|
if(isset($systemInfoArray["AIRTIME_VERSION_URL"])){
|
||||||
|
$url = $systemInfoArray["AIRTIME_VERSION_URL"];
|
||||||
|
$index = strpos($url,'/api/');
|
||||||
|
$url = substr($url, 0, $index);
|
||||||
|
|
||||||
|
$headerInfo = get_headers(trim($url),1);
|
||||||
|
$outputArray['WEB_SERVER'] = $headerInfo['Server'][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$outputArray['NUM_OF_USERS'] = User::getUserCount();
|
||||||
|
$outputArray['NUM_OF_SONGS'] = StoredFile::getFileCount();
|
||||||
|
$outputArray['NUM_OF_PLAYLISTS'] = Playlist::getPlaylistCount();
|
||||||
|
$outputArray['NUM_OF_SCHEDULED_PLAYLISTS'] = Schedule::getSchduledPlaylistCount();
|
||||||
|
$outputArray['NUM_OF_PAST_SHOWS'] = ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
|
||||||
|
$outputArray['UNIQUE_ID'] = Application_Model_Preference::GetUniqueId();
|
||||||
|
|
||||||
|
$outputArray = array_merge($systemInfoArray, $outputArray);
|
||||||
|
|
||||||
|
$outputString = "\n";
|
||||||
|
foreach($outputArray as $key => $out){
|
||||||
|
if($out != ''){
|
||||||
|
$outputString .= $key.' : '.$out."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($returnArray){
|
||||||
|
$outputArray['PROMOTE'] = Application_Model_Preference::GetPublicise();
|
||||||
|
$outputArray['LOGOIMG'] = Application_Model_Preference::GetStationLogo();
|
||||||
|
return $outputArray;
|
||||||
|
}else{
|
||||||
|
return $outputString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetRemindMeDate($now){
|
||||||
|
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y"));
|
||||||
|
Application_Model_Preference::SetValue("remindme", $weekAfter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetRemindMeDate(){
|
||||||
|
return Application_Model_Preference::GetValue("remindme");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetImportTimestamp(){
|
||||||
|
$now = time();
|
||||||
|
if(Application_Model_Preference::GetImportTimestamp()+5 < $now){
|
||||||
|
Application_Model_Preference::SetValue("import_timestamp", $now);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetImportTimestamp(){
|
||||||
|
return Application_Model_Preference::GetValue("import_timestamp");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,17 @@ class RabbitMq
|
||||||
$channel->basic_publish($msg, $EXCHANGE);
|
$channel->basic_publish($msg, $EXCHANGE);
|
||||||
$channel->close();
|
$channel->close();
|
||||||
$conn->close();
|
$conn->close();
|
||||||
|
|
||||||
|
self::SendMessageToShowRecorder("update_schedule");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
public static function SendMessageToMediaMonitor($event_type, $md)
|
||||||
* wait for 1.9.0 release
|
|
||||||
|
|
||||||
public static function SendFileMetaData($md)
|
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$md["event_type"] = $event_type;
|
||||||
|
|
||||||
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||||
$CC_CONFIG["rabbitmq"]["port"],
|
$CC_CONFIG["rabbitmq"]["port"],
|
||||||
$CC_CONFIG["rabbitmq"]["user"],
|
$CC_CONFIG["rabbitmq"]["user"],
|
||||||
|
@ -64,7 +65,35 @@ class RabbitMq
|
||||||
$channel->close();
|
$channel->close();
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
public static function SendMessageToShowRecorder($event_type)
|
||||||
|
{
|
||||||
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$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-show-recorder';
|
||||||
|
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||||
|
|
||||||
|
$today_timestamp = date("Y-m-d H:i:s");
|
||||||
|
$now = new DateTime($today_timestamp);
|
||||||
|
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
||||||
|
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
|
||||||
|
$temp['event_type'] = $event_type;
|
||||||
|
if($event_type = "update_schedule"){
|
||||||
|
$temp['shows'] = Show::getShows($today_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=TRUE);
|
||||||
|
}
|
||||||
|
$data = json_encode($temp);
|
||||||
|
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
||||||
|
|
||||||
|
$channel->basic_publish($msg, $EXCHANGE);
|
||||||
|
$channel->close();
|
||||||
|
$conn->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class ScheduleGroup {
|
||||||
|
|
||||||
// Check if there are any conflicts with existing entries
|
// Check if there are any conflicts with existing entries
|
||||||
$metadata = $track->getMetadata();
|
$metadata = $track->getMetadata();
|
||||||
$length = trim($metadata["length"]);
|
$length = $metadata['MDATA_KEY_DURATION'];
|
||||||
if (empty($length)) {
|
if (empty($length)) {
|
||||||
return new PEAR_Error("Length is empty.");
|
return new PEAR_Error("Length is empty.");
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,9 @@ class ScheduleGroup {
|
||||||
." st.cue_out,"
|
." st.cue_out,"
|
||||||
." st.clip_length,"
|
." st.clip_length,"
|
||||||
." st.fade_in,"
|
." st.fade_in,"
|
||||||
." st.fade_out"
|
." st.fade_out,"
|
||||||
|
." st.starts,"
|
||||||
|
." st.ends"
|
||||||
." FROM $CC_CONFIG[scheduleTable] as st"
|
." FROM $CC_CONFIG[scheduleTable] as st"
|
||||||
." LEFT JOIN $CC_CONFIG[showInstances] as si"
|
." LEFT JOIN $CC_CONFIG[showInstances] as si"
|
||||||
." ON st.instance_id = si.id"
|
." ON st.instance_id = si.id"
|
||||||
|
@ -374,18 +376,23 @@ class Schedule {
|
||||||
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
|
"currentShow"=>Show_DAL::GetCurrentShow($timeNow),
|
||||||
"nextShow"=>Show_DAL::GetNextShows($timeNow, 1),
|
"nextShow"=>Show_DAL::GetNextShows($timeNow, 1),
|
||||||
"timezone"=> date("T"),
|
"timezone"=> date("T"),
|
||||||
"timezoneOffset"=> date("Z"),
|
"timezoneOffset"=> date("Z"));
|
||||||
"apiKey"=>$CC_CONFIG['apiKey'][0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetLastScheduleItem($p_timeNow){
|
public static function GetLastScheduleItem($p_timeNow){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
$sql = "SELECT *"
|
$sql = "SELECT"
|
||||||
|
." ft.artist_name, ft.track_title,"
|
||||||
|
." st.starts as starts, st.ends as ends"
|
||||||
." FROM $CC_CONFIG[scheduleTable] st"
|
." FROM $CC_CONFIG[scheduleTable] st"
|
||||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||||
." ON st.file_id = ft.id"
|
." ON st.file_id = ft.id"
|
||||||
|
." LEFT JOIN $CC_CONFIG[showInstances] sit"
|
||||||
|
." ON st.instance_id = sit.id"
|
||||||
." WHERE st.ends < TIMESTAMP '$p_timeNow'"
|
." WHERE st.ends < TIMESTAMP '$p_timeNow'"
|
||||||
|
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
|
||||||
|
." AND st.starts < sit.ends"
|
||||||
." ORDER BY st.ends DESC"
|
." ORDER BY st.ends DESC"
|
||||||
." LIMIT 1";
|
." LIMIT 1";
|
||||||
|
|
||||||
|
@ -397,6 +404,13 @@ class Schedule {
|
||||||
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId){
|
public static function GetCurrentScheduleItem($p_timeNow, $p_instanceId){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
|
/* Note that usually there will be one result returned. In some
|
||||||
|
* rare cases two songs are returned. This happens when a track
|
||||||
|
* that was overbooked from a previous show appears as if it
|
||||||
|
* hasnt ended yet (track end time hasn't been reached yet). For
|
||||||
|
* this reason, we need to get the track that starts later, as
|
||||||
|
* this is the *real* track that is currently playing. So this
|
||||||
|
* is why we are ordering by track start time. */
|
||||||
$sql = "SELECT *"
|
$sql = "SELECT *"
|
||||||
." FROM $CC_CONFIG[scheduleTable] st"
|
." FROM $CC_CONFIG[scheduleTable] st"
|
||||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||||
|
@ -404,6 +418,7 @@ class Schedule {
|
||||||
." WHERE st.starts <= TIMESTAMP '$p_timeNow'"
|
." WHERE st.starts <= TIMESTAMP '$p_timeNow'"
|
||||||
." AND st.instance_id = $p_instanceId"
|
." AND st.instance_id = $p_instanceId"
|
||||||
." AND st.ends > TIMESTAMP '$p_timeNow'"
|
." AND st.ends > TIMESTAMP '$p_timeNow'"
|
||||||
|
." ORDER BY st.starts DESC"
|
||||||
." LIMIT 1";
|
." LIMIT 1";
|
||||||
|
|
||||||
$row = $CC_DBC->GetAll($sql);
|
$row = $CC_DBC->GetAll($sql);
|
||||||
|
@ -413,11 +428,17 @@ class Schedule {
|
||||||
public static function GetNextScheduleItem($p_timeNow){
|
public static function GetNextScheduleItem($p_timeNow){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
$sql = "SELECT *"
|
$sql = "SELECT"
|
||||||
|
." ft.artist_name, ft.track_title,"
|
||||||
|
." st.starts as starts, st.ends as ends"
|
||||||
." FROM $CC_CONFIG[scheduleTable] st"
|
." FROM $CC_CONFIG[scheduleTable] st"
|
||||||
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
." LEFT JOIN $CC_CONFIG[filesTable] ft"
|
||||||
." ON st.file_id = ft.id"
|
." ON st.file_id = ft.id"
|
||||||
|
." LEFT JOIN $CC_CONFIG[showInstances] sit"
|
||||||
|
." ON st.instance_id = sit.id"
|
||||||
." WHERE st.starts > TIMESTAMP '$p_timeNow'"
|
." WHERE st.starts > TIMESTAMP '$p_timeNow'"
|
||||||
|
." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows.
|
||||||
|
." AND st.starts < sit.ends"
|
||||||
." ORDER BY st.starts"
|
." ORDER BY st.starts"
|
||||||
." LIMIT 1";
|
." LIMIT 1";
|
||||||
|
|
||||||
|
@ -520,6 +541,12 @@ class Schedule {
|
||||||
return $retVal;
|
return $retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getSchduledPlaylistCount(){
|
||||||
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
$sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['scheduleTable'];
|
||||||
|
return $CC_DBC->GetOne($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a time string in the format "YYYY-MM-DD HH:mm:SS"
|
* Convert a time string in the format "YYYY-MM-DD HH:mm:SS"
|
||||||
|
@ -662,7 +689,7 @@ class Schedule {
|
||||||
$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]['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';
|
||||||
|
@ -682,27 +709,24 @@ class Schedule {
|
||||||
$scheduleGroup = new ScheduleGroup($playlist["schedule_id"]);
|
$scheduleGroup = new ScheduleGroup($playlist["schedule_id"]);
|
||||||
$items = $scheduleGroup->getItems();
|
$items = $scheduleGroup->getItems();
|
||||||
$medias = array();
|
$medias = array();
|
||||||
$playlist['subtype'] = '1';
|
|
||||||
foreach ($items as $item)
|
foreach ($items as $item)
|
||||||
{
|
{
|
||||||
$storedFile = StoredFile::Recall($item["file_id"]);
|
$storedFile = StoredFile::Recall($item["file_id"]);
|
||||||
$uri = $storedFile->getFileUrl();
|
$uri = $storedFile->getFileUrl();
|
||||||
|
|
||||||
// For pypo, a cueout of zero means no cueout
|
$starts = Schedule::AirtimeTimeToPypoTime($item["starts"]);
|
||||||
$cueOut = "0";
|
$medias[$starts] = array(
|
||||||
if (Schedule::TimeDiff($item["cue_out"], $item["clip_length"]) > 0.001) {
|
|
||||||
$cueOut = Schedule::WallTimeToMillisecs($item["cue_out"]);
|
|
||||||
}
|
|
||||||
$medias[] = 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' => Schedule::WallTimeToMillisecs($item["fade_in"]),
|
||||||
'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),
|
'fade_out' => Schedule::WallTimeToMillisecs($item["fade_out"]),
|
||||||
'fade_cross' => 0,
|
'fade_cross' => 0,
|
||||||
'cue_in' => Schedule::WallTimeToMillisecs($item["cue_in"]),
|
'cue_in' => DateHelper::CalculateLengthInSeconds($item["cue_in"]),
|
||||||
'cue_out' => $cueOut,
|
'cue_out' => DateHelper::CalculateLengthInSeconds($item["cue_out"]),
|
||||||
'export_source' => 'scheduler'
|
'export_source' => 'scheduler',
|
||||||
|
'start' => $starts,
|
||||||
|
'end' => Schedule::AirtimeTimeToPypoTime($item["ends"])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$playlist['medias'] = $medias;
|
$playlist['medias'] = $medias;
|
||||||
|
@ -726,7 +750,7 @@ class Schedule {
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
$CC_DBC->query("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
|
$CC_DBC->query("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createNewFormSections($p_view){
|
public static function createNewFormSections($p_view){
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$formWhat = new Application_Form_AddShowWhat();
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$formWho = new Application_Form_AddShowWho();
|
||||||
|
@ -745,7 +769,7 @@ class Schedule {
|
||||||
$formRecord->removeDecorator('DtDdWrapper');
|
$formRecord->removeDecorator('DtDdWrapper');
|
||||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||||
$formRebroadcast->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;
|
||||||
|
@ -755,8 +779,15 @@ class Schedule {
|
||||||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
$p_view->rebroadcast = $formRebroadcast;
|
$p_view->rebroadcast = $formRebroadcast;
|
||||||
$p_view->addNewShow = true;
|
$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"),
|
||||||
|
'add_show_start_time' => '00:00',
|
||||||
|
'add_show_end_date_no_repeate' => date("Y-m-d"),
|
||||||
|
'add_show_end_time' => '01:00',
|
||||||
|
'add_show_duration' => '1h'));
|
||||||
|
|
||||||
|
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -433,6 +433,45 @@ class Show {
|
||||||
return $startTime;
|
return $startTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the end date of the current show.
|
||||||
|
* Note that this is not the end date of repeated show
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* The end date in the format YYYY-MM-DD
|
||||||
|
*/
|
||||||
|
public function getEndDate(){
|
||||||
|
$startDate = $this->getStartDate();
|
||||||
|
$startTime = $this->getStartTime();
|
||||||
|
$duration = $this->getDuration();
|
||||||
|
|
||||||
|
$startDateTime = new DateTime($startDate.' '.$startTime);
|
||||||
|
$duration = explode(":", $duration);
|
||||||
|
|
||||||
|
$endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
|
||||||
|
|
||||||
|
return $endDate->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the end time of the current show.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* The start time in the format HH:MM:SS
|
||||||
|
*/
|
||||||
|
public function getEndTime(){
|
||||||
|
$startDate = $this->getStartDate();
|
||||||
|
$startTime = $this->getStartTime();
|
||||||
|
$duration = $this->getDuration();
|
||||||
|
|
||||||
|
$startDateTime = new DateTime($startDate.' '.$startTime);
|
||||||
|
$duration = explode(":", $duration);
|
||||||
|
|
||||||
|
$endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
|
||||||
|
|
||||||
|
return $endDate->format('H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether the starting point of the show is in the
|
* Indicate whether the starting point of the show is in the
|
||||||
|
@ -535,9 +574,14 @@ class Show {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDuration(){
|
public function getDuration($format=false){
|
||||||
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
|
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
|
||||||
return $showDay->getDbDuration();
|
if(!$format){
|
||||||
|
return $showDay->getDbDuration();
|
||||||
|
}else{
|
||||||
|
$info = explode(':',$showDay->getDbDuration());
|
||||||
|
return ($info[0] != 0 ? intval($info[0]).'h'.' ' : '').($info[1] != 0 ? intval($info[1]).'m' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShowDays(){
|
public function getShowDays(){
|
||||||
|
@ -1314,7 +1358,7 @@ class ShowInstance {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists($file->getRealFilePath())) {
|
if(file_exists($file->getFilePath())) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1567,10 +1611,17 @@ class ShowInstance {
|
||||||
|
|
||||||
public function deleteShow()
|
public function deleteShow()
|
||||||
{
|
{
|
||||||
|
// see if it was recording show
|
||||||
|
$recording = CcShowInstancesQuery::create()
|
||||||
|
->findPK($this->_instanceId)
|
||||||
|
->getDbRecord();
|
||||||
CcShowInstancesQuery::create()
|
CcShowInstancesQuery::create()
|
||||||
->findPK($this->_instanceId)
|
->findPK($this->_instanceId)
|
||||||
->delete();
|
->delete();
|
||||||
RabbitMq::PushSchedule();
|
RabbitMq::PushSchedule();
|
||||||
|
if($recording){
|
||||||
|
RabbitMq::SendMessageToShowRecorder("cancel_recording");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setRecordedFile($file_id)
|
public function setRecordedFile($file_id)
|
||||||
|
@ -1822,6 +1873,13 @@ class ShowInstance {
|
||||||
return new ShowInstance($id);
|
return new 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show Data Access Layer */
|
/* Show Data Access Layer */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
define('UTYPE_HOST', 'H');
|
||||||
|
define('UTYPE_ADMIN', 'A');
|
||||||
|
define('UTYPE_GUEST', 'G');
|
||||||
|
define('UTYPE_PROGRAM_MANAGER', 'P');
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
|
|
||||||
private $_userInstance;
|
private $_userInstance;
|
||||||
|
@ -18,12 +23,44 @@ class User {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isHost($showId) {
|
public function isHost($showId) {
|
||||||
$userId = $this->_userInstance->getDbId();
|
return $this->isUserType(UTYPE_HOST, $showId);
|
||||||
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAdmin() {
|
public function isAdmin() {
|
||||||
return $this->_userInstance->getDbType() === 'A';
|
return $this->isUserType(UTYPE_ADMIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isUserType($type, $showId=''){
|
||||||
|
if(is_array($type)){
|
||||||
|
$result = false;
|
||||||
|
foreach($type as $t){
|
||||||
|
switch($t){
|
||||||
|
case UTYPE_ADMIN:
|
||||||
|
$result = $this->_userInstance->getDbType() === 'A';
|
||||||
|
break;
|
||||||
|
case UTYPE_HOST:
|
||||||
|
$userId = $this->_userInstance->getDbId();
|
||||||
|
$result = CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||||
|
break;
|
||||||
|
case UTYPE_PROGRAM_MANAGER:
|
||||||
|
$result = $this->_userInstance->getDbType() === 'P';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if($result){
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
switch($type){
|
||||||
|
case UTYPE_ADMIN:
|
||||||
|
return $this->_userInstance->getDbType() === 'A';
|
||||||
|
case UTYPE_HOST:
|
||||||
|
$userId = $this->_userInstance->getDbId();
|
||||||
|
return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0;
|
||||||
|
case UTYPE_PROGRAM_MANAGER:
|
||||||
|
return $this->_userInstance->getDbType() === 'P';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setLogin($login){
|
public function setLogin($login){
|
||||||
|
@ -151,6 +188,33 @@ class User {
|
||||||
|
|
||||||
return $CC_DBC->GetAll($sql);
|
return $CC_DBC->GetAll($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getUserCount($type=NULL){
|
||||||
|
global $CC_DBC;
|
||||||
|
|
||||||
|
$sql;
|
||||||
|
|
||||||
|
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
||||||
|
|
||||||
|
if(!isset($type)){
|
||||||
|
$sql = $sql_gen;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(is_array($type)) {
|
||||||
|
for($i=0; $i<count($type); $i++) {
|
||||||
|
$type[$i] = "type = '{$type[$i]}'";
|
||||||
|
}
|
||||||
|
$sql_type = join(" OR ", $type);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql_type = "type = {$type}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $CC_DBC->GetOne($sql);
|
||||||
|
}
|
||||||
|
|
||||||
public static function getHosts($search=NULL) {
|
public static function getHosts($search=NULL) {
|
||||||
return User::getUsers(array('H'), $search);
|
return User::getUsers(array('H'), $search);
|
||||||
|
|
18
airtime_mvc/application/models/airtime/CcCountry.php
Normal file
18
airtime_mvc/application/models/airtime/CcCountry.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_country' 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 CcCountry extends BaseCcCountry {
|
||||||
|
|
||||||
|
} // CcCountry
|
18
airtime_mvc/application/models/airtime/CcCountryPeer.php
Normal file
18
airtime_mvc/application/models/airtime/CcCountryPeer.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_country' 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 CcCountryPeer extends BaseCcCountryPeer {
|
||||||
|
|
||||||
|
} // CcCountryPeer
|
18
airtime_mvc/application/models/airtime/CcCountryQuery.php
Normal file
18
airtime_mvc/application/models/airtime/CcCountryQuery.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_country' 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 CcCountryQuery extends BaseCcCountryQuery {
|
||||||
|
|
||||||
|
} // CcCountryQuery
|
18
airtime_mvc/application/models/airtime/CcMusicDirs.php
Normal file
18
airtime_mvc/application/models/airtime/CcMusicDirs.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_music_dirs' 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 CcMusicDirs extends BaseCcMusicDirs {
|
||||||
|
|
||||||
|
} // CcMusicDirs
|
18
airtime_mvc/application/models/airtime/CcMusicDirsPeer.php
Normal file
18
airtime_mvc/application/models/airtime/CcMusicDirsPeer.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' 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 CcMusicDirsPeer extends BaseCcMusicDirsPeer {
|
||||||
|
|
||||||
|
} // CcMusicDirsPeer
|
18
airtime_mvc/application/models/airtime/CcMusicDirsQuery.php
Normal file
18
airtime_mvc/application/models/airtime/CcMusicDirsQuery.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for performing query and update operations on the 'cc_music_dirs' 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 CcMusicDirsQuery extends BaseCcMusicDirsQuery {
|
||||||
|
|
||||||
|
} // CcMusicDirsQuery
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'cc_country' 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 CcCountryTableMap extends TableMap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'airtime.map.CcCountryTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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_country');
|
||||||
|
$this->setPhpName('CcCountry');
|
||||||
|
$this->setClassname('CcCountry');
|
||||||
|
$this->setPackage('airtime');
|
||||||
|
$this->setUseIdGenerator(false);
|
||||||
|
// columns
|
||||||
|
$this->addPrimaryKey('ISOCODE', 'DbIsoCode', 'CHAR', true, 3, null);
|
||||||
|
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // CcCountryTableMap
|
|
@ -43,6 +43,7 @@ class CcFilesTableMap extends TableMap {
|
||||||
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
|
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
|
||||||
$this->addColumn('MIME', 'DbMime', 'VARCHAR', true, 255, '');
|
$this->addColumn('MIME', 'DbMime', 'VARCHAR', true, 255, '');
|
||||||
$this->addColumn('FTYPE', 'DbFtype', 'VARCHAR', true, 128, '');
|
$this->addColumn('FTYPE', 'DbFtype', 'VARCHAR', true, 128, '');
|
||||||
|
$this->addForeignKey('DIRECTORY', 'DbDirectory', 'INTEGER', 'cc_music_dirs', 'ID', false, null, null);
|
||||||
$this->addColumn('FILEPATH', 'DbFilepath', 'LONGVARCHAR', false, null, '');
|
$this->addColumn('FILEPATH', 'DbFilepath', 'LONGVARCHAR', false, null, '');
|
||||||
$this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty');
|
$this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty');
|
||||||
$this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
|
$this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
|
||||||
|
@ -101,8 +102,10 @@ class CcFilesTableMap extends TableMap {
|
||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
|
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
|
||||||
|
$this->addRelation('CcMusicDirs', 'CcMusicDirs', RelationMap::MANY_TO_ONE, array('directory' => 'id', ), 'CASCADE', null);
|
||||||
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||||
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||||
|
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'file_id', ), 'CASCADE', null);
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
} // CcFilesTableMap
|
} // CcFilesTableMap
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class defines the structure of the 'cc_music_dirs' 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 CcMusicDirsTableMap extends TableMap {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The (dot-path) name of this class
|
||||||
|
*/
|
||||||
|
const CLASS_NAME = 'airtime.map.CcMusicDirsTableMap';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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_music_dirs');
|
||||||
|
$this->setPhpName('CcMusicDirs');
|
||||||
|
$this->setClassname('CcMusicDirs');
|
||||||
|
$this->setPackage('airtime');
|
||||||
|
$this->setUseIdGenerator(true);
|
||||||
|
$this->setPrimaryKeyMethodInfo('cc_music_dirs_id_seq');
|
||||||
|
// columns
|
||||||
|
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
|
||||||
|
$this->addColumn('DIRECTORY', 'Directory', 'LONGVARCHAR', false, null, null);
|
||||||
|
$this->addColumn('TYPE', 'Type', 'VARCHAR', false, 255, null);
|
||||||
|
// validators
|
||||||
|
} // initialize()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the RelationMap objects for this table relationships
|
||||||
|
*/
|
||||||
|
public function buildRelations()
|
||||||
|
{
|
||||||
|
$this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'directory', ), 'CASCADE', null);
|
||||||
|
} // buildRelations()
|
||||||
|
|
||||||
|
} // CcMusicDirsTableMap
|
|
@ -43,7 +43,7 @@ class CcScheduleTableMap extends TableMap {
|
||||||
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
|
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
|
||||||
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
|
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
|
||||||
$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null);
|
$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null);
|
||||||
$this->addColumn('FILE_ID', 'DbFileId', 'INTEGER', false, null, null);
|
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
||||||
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
|
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
|
||||||
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
|
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
|
||||||
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
|
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
|
||||||
|
@ -61,6 +61,7 @@ class CcScheduleTableMap extends TableMap {
|
||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
|
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
|
||||||
|
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
708
airtime_mvc/application/models/airtime/om/BaseCcCountry.php
Normal file
708
airtime_mvc/application/models/airtime/om/BaseCcCountry.php
Normal file
|
@ -0,0 +1,708 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a row from the 'cc_country' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcCountry extends BaseObject implements Persistent
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer class name
|
||||||
|
*/
|
||||||
|
const PEER = 'CcCountryPeer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 CcCountryPeer
|
||||||
|
*/
|
||||||
|
protected static $peer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the isocode field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $isocode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the name field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 [isocode] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbIsoCode()
|
||||||
|
{
|
||||||
|
return $this->isocode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [name] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDbName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [isocode] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcCountry The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDbIsoCode($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->isocode !== $v) {
|
||||||
|
$this->isocode = $v;
|
||||||
|
$this->modifiedColumns[] = CcCountryPeer::ISOCODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbIsoCode()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [name] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcCountry 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[] = CcCountryPeer::NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDbName()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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->isocode = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null;
|
||||||
|
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
|
||||||
|
$this->resetModified();
|
||||||
|
|
||||||
|
$this->setNew(false);
|
||||||
|
|
||||||
|
if ($rehydrate) {
|
||||||
|
$this->ensureConsistency();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $startcol + 2; // 2 = CcCountryPeer::NUM_COLUMNS - CcCountryPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new PropelException("Error populating CcCountry 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(CcCountryPeer::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 = CcCountryPeer::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(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$con->beginTransaction();
|
||||||
|
try {
|
||||||
|
$ret = $this->preDelete($con);
|
||||||
|
if ($ret) {
|
||||||
|
CcCountryQuery::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(CcCountryPeer::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);
|
||||||
|
CcCountryPeer::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 = CcCountryPeer::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 = CcCountryPeer::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 = CcCountryPeer::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->getDbIsoCode();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return $this->getDbName();
|
||||||
|
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 = CcCountryPeer::getFieldNames($keyType);
|
||||||
|
$result = array(
|
||||||
|
$keys[0] => $this->getDbIsoCode(),
|
||||||
|
$keys[1] => $this->getDbName(),
|
||||||
|
);
|
||||||
|
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 = CcCountryPeer::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->setDbIsoCode($value);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$this->setDbName($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 = CcCountryPeer::getFieldNames($keyType);
|
||||||
|
|
||||||
|
if (array_key_exists($keys[0], $arr)) $this->setDbIsoCode($arr[$keys[0]]);
|
||||||
|
if (array_key_exists($keys[1], $arr)) $this->setDbName($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(CcCountryPeer::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($this->isColumnModified(CcCountryPeer::ISOCODE)) $criteria->add(CcCountryPeer::ISOCODE, $this->isocode);
|
||||||
|
if ($this->isColumnModified(CcCountryPeer::NAME)) $criteria->add(CcCountryPeer::NAME, $this->name);
|
||||||
|
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a Criteria object containing the primary key for this object.
|
||||||
|
*
|
||||||
|
* Unlike buildCriteria() this method includes the primary key values regardless
|
||||||
|
* of whether or not they have been modified.
|
||||||
|
*
|
||||||
|
* @return Criteria The Criteria object containing value(s) for primary key(s).
|
||||||
|
*/
|
||||||
|
public function buildPkeyCriteria()
|
||||||
|
{
|
||||||
|
$criteria = new Criteria(CcCountryPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(CcCountryPeer::ISOCODE, $this->isocode);
|
||||||
|
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the primary key for this object (row).
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPrimaryKey()
|
||||||
|
{
|
||||||
|
return $this->getDbIsoCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic method to set the primary key (isocode column).
|
||||||
|
*
|
||||||
|
* @param string $key Primary key.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->setDbIsoCode($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the primary key for this object is null.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isPrimaryKeyNull()
|
||||||
|
{
|
||||||
|
return null === $this->getDbIsoCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 CcCountry (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->setDbIsoCode($this->isocode);
|
||||||
|
$copyObj->setDbName($this->name);
|
||||||
|
|
||||||
|
$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 CcCountry 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 CcCountryPeer
|
||||||
|
*/
|
||||||
|
public function getPeer()
|
||||||
|
{
|
||||||
|
if (self::$peer === null) {
|
||||||
|
self::$peer = new CcCountryPeer();
|
||||||
|
}
|
||||||
|
return self::$peer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the current object and sets all attributes to their default values
|
||||||
|
*/
|
||||||
|
public function clear()
|
||||||
|
{
|
||||||
|
$this->isocode = null;
|
||||||
|
$this->name = null;
|
||||||
|
$this->alreadyInSave = false;
|
||||||
|
$this->alreadyInValidation = false;
|
||||||
|
$this->clearAllReferences();
|
||||||
|
$this->resetModified();
|
||||||
|
$this->setNew(true);
|
||||||
|
$this->setDeleted(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets all collections of referencing foreign keys.
|
||||||
|
*
|
||||||
|
* This method is a user-space workaround for PHP's inability to garbage collect objects
|
||||||
|
* with circular references. This is currently necessary when using Propel in certain
|
||||||
|
* daemon or large-volumne/high-memory operations.
|
||||||
|
*
|
||||||
|
* @param boolean $deep Whether to also clear the references on all associated objects.
|
||||||
|
*/
|
||||||
|
public function clearAllReferences($deep = false)
|
||||||
|
{
|
||||||
|
if ($deep) {
|
||||||
|
} // if ($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);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // BaseCcCountry
|
735
airtime_mvc/application/models/airtime/om/BaseCcCountryPeer.php
Normal file
735
airtime_mvc/application/models/airtime/om/BaseCcCountryPeer.php
Normal file
|
@ -0,0 +1,735 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base static class for performing query and update operations on the 'cc_country' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcCountryPeer {
|
||||||
|
|
||||||
|
/** the default database name for this class */
|
||||||
|
const DATABASE_NAME = 'airtime';
|
||||||
|
|
||||||
|
/** the table name for this class */
|
||||||
|
const TABLE_NAME = 'cc_country';
|
||||||
|
|
||||||
|
/** the related Propel class for this table */
|
||||||
|
const OM_CLASS = 'CcCountry';
|
||||||
|
|
||||||
|
/** A class that can be returned by this peer. */
|
||||||
|
const CLASS_DEFAULT = 'airtime.CcCountry';
|
||||||
|
|
||||||
|
/** the related TableMap class for this table */
|
||||||
|
const TM_CLASS = 'CcCountryTableMap';
|
||||||
|
|
||||||
|
/** 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 ISOCODE field */
|
||||||
|
const ISOCODE = 'cc_country.ISOCODE';
|
||||||
|
|
||||||
|
/** the column name for the NAME field */
|
||||||
|
const NAME = 'cc_country.NAME';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identiy map to hold any loaded instances of CcCountry objects.
|
||||||
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
|
* queries.
|
||||||
|
* @var array CcCountry[]
|
||||||
|
*/
|
||||||
|
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 ('DbIsoCode', 'DbName', ),
|
||||||
|
BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode', 'dbName', ),
|
||||||
|
BasePeer::TYPE_COLNAME => array (self::ISOCODE, self::NAME, ),
|
||||||
|
BasePeer::TYPE_RAW_COLNAME => array ('ISOCODE', 'NAME', ),
|
||||||
|
BasePeer::TYPE_FIELDNAME => array ('isocode', 'name', ),
|
||||||
|
BasePeer::TYPE_NUM => array (0, 1, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* holds an array of keys for quick access to the fieldnames array
|
||||||
|
*
|
||||||
|
* first dimension keys are the type constants
|
||||||
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
|
*/
|
||||||
|
private static $fieldKeys = array (
|
||||||
|
BasePeer::TYPE_PHPNAME => array ('DbIsoCode' => 0, 'DbName' => 1, ),
|
||||||
|
BasePeer::TYPE_STUDLYPHPNAME => array ('dbIsoCode' => 0, 'dbName' => 1, ),
|
||||||
|
BasePeer::TYPE_COLNAME => array (self::ISOCODE => 0, self::NAME => 1, ),
|
||||||
|
BasePeer::TYPE_RAW_COLNAME => array ('ISOCODE' => 0, 'NAME' => 1, ),
|
||||||
|
BasePeer::TYPE_FIELDNAME => array ('isocode' => 0, 'name' => 1, ),
|
||||||
|
BasePeer::TYPE_NUM => array (0, 1, )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates a fieldname to another type
|
||||||
|
*
|
||||||
|
* @param string $name field name
|
||||||
|
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
|
||||||
|
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
|
||||||
|
* @param string $toType One of the class type constants
|
||||||
|
* @return string translated name of the field.
|
||||||
|
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
|
||||||
|
*/
|
||||||
|
static public function translateFieldName($name, $fromType, $toType)
|
||||||
|
{
|
||||||
|
$toNames = self::getFieldNames($toType);
|
||||||
|
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
|
||||||
|
if ($key === null) {
|
||||||
|
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
|
||||||
|
}
|
||||||
|
return $toNames[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array of field names.
|
||||||
|
*
|
||||||
|
* @param string $type The type of fieldnames to return:
|
||||||
|
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
|
||||||
|
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
|
||||||
|
* @return array A list of field names
|
||||||
|
*/
|
||||||
|
|
||||||
|
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
|
||||||
|
{
|
||||||
|
if (!array_key_exists($type, self::$fieldNames)) {
|
||||||
|
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
|
||||||
|
}
|
||||||
|
return self::$fieldNames[$type];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method which changes table.column to alias.column.
|
||||||
|
*
|
||||||
|
* Using this method you can maintain SQL abstraction while using column aliases.
|
||||||
|
* <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. CcCountryPeer::COLUMN_NAME).
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function alias($alias, $column)
|
||||||
|
{
|
||||||
|
return str_replace(CcCountryPeer::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(CcCountryPeer::ISOCODE);
|
||||||
|
$criteria->addSelectColumn(CcCountryPeer::NAME);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.ISOCODE');
|
||||||
|
$criteria->addSelectColumn($alias . '.NAME');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
// we may modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(CcCountryPeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcCountryPeer::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(CcCountryPeer::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 CcCountry
|
||||||
|
* @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 = CcCountryPeer::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 CcCountryPeer::populateObjects(CcCountryPeer::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(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
CcCountryPeer::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 CcCountry $value A CcCountry object.
|
||||||
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||||
|
*/
|
||||||
|
public static function addInstanceToPool(CcCountry $obj, $key = null)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled()) {
|
||||||
|
if ($key === null) {
|
||||||
|
$key = (string) $obj->getDbIsoCode();
|
||||||
|
} // 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 CcCountry object or a primary key value.
|
||||||
|
*/
|
||||||
|
public static function removeInstanceFromPool($value)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled() && $value !== null) {
|
||||||
|
if (is_object($value) && $value instanceof CcCountry) {
|
||||||
|
$key = (string) $value->getDbIsoCode();
|
||||||
|
} 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 CcCountry 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 CcCountry 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_country
|
||||||
|
* 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 = CcCountryPeer::getOMClass(false);
|
||||||
|
// populate the object(s)
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key = CcCountryPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj = CcCountryPeer::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;
|
||||||
|
CcCountryPeer::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 (CcCountry object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $startcol = 0)
|
||||||
|
{
|
||||||
|
$key = CcCountryPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||||
|
if (null !== ($obj = CcCountryPeer::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 + CcCountryPeer::NUM_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = CcCountryPeer::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $startcol);
|
||||||
|
CcCountryPeer::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(BaseCcCountryPeer::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(BaseCcCountryPeer::TABLE_NAME))
|
||||||
|
{
|
||||||
|
$dbMap->addTableObject(new CcCountryTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ? CcCountryPeer::CLASS_DEFAULT : CcCountryPeer::OM_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method perform an INSERT on the database, given a CcCountry or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CcCountry 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(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
$criteria = clone $values; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $values->buildCriteria(); // build Criteria from CcCountry 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 CcCountry or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CcCountry 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(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
$criteria = clone $values; // rename for clarity
|
||||||
|
|
||||||
|
$comparison = $criteria->getComparison(CcCountryPeer::ISOCODE);
|
||||||
|
$value = $criteria->remove(CcCountryPeer::ISOCODE);
|
||||||
|
if ($value) {
|
||||||
|
$selectCriteria->add(CcCountryPeer::ISOCODE, $value, $comparison);
|
||||||
|
} else {
|
||||||
|
$selectCriteria->setPrimaryTableName(CcCountryPeer::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // $values is CcCountry 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_country 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(CcCountryPeer::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(CcCountryPeer::TABLE_NAME, $con, CcCountryPeer::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).
|
||||||
|
CcCountryPeer::clearInstancePool();
|
||||||
|
CcCountryPeer::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method perform a DELETE on the database, given a CcCountry or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CcCountry 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(CcCountryPeer::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.
|
||||||
|
CcCountryPeer::clearInstancePool();
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = clone $values;
|
||||||
|
} elseif ($values instanceof CcCountry) { // it's a model object
|
||||||
|
// invalidate the cache for this single object
|
||||||
|
CcCountryPeer::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(CcCountryPeer::ISOCODE, (array) $values, Criteria::IN);
|
||||||
|
// invalidate the cache for this object(s)
|
||||||
|
foreach ((array) $values as $singleval) {
|
||||||
|
CcCountryPeer::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);
|
||||||
|
CcCountryPeer::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates all modified columns of given CcCountry 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 CcCountry $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(CcCountry $obj, $cols = null)
|
||||||
|
{
|
||||||
|
$columns = array();
|
||||||
|
|
||||||
|
if ($cols) {
|
||||||
|
$dbMap = Propel::getDatabaseMap(CcCountryPeer::DATABASE_NAME);
|
||||||
|
$tableMap = $dbMap->getTable(CcCountryPeer::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(CcCountryPeer::DATABASE_NAME, CcCountryPeer::TABLE_NAME, $columns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a single object by pkey.
|
||||||
|
*
|
||||||
|
* @param string $pk the primary key.
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @return CcCountry
|
||||||
|
*/
|
||||||
|
public static function retrieveByPK($pk, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null !== ($obj = CcCountryPeer::getInstanceFromPool((string) $pk))) {
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = new Criteria(CcCountryPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(CcCountryPeer::ISOCODE, $pk);
|
||||||
|
|
||||||
|
$v = CcCountryPeer::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(CcCountryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objs = null;
|
||||||
|
if (empty($pks)) {
|
||||||
|
$objs = array();
|
||||||
|
} else {
|
||||||
|
$criteria = new Criteria(CcCountryPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(CcCountryPeer::ISOCODE, $pks, Criteria::IN);
|
||||||
|
$objs = CcCountryPeer::doSelect($criteria, $con);
|
||||||
|
}
|
||||||
|
return $objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // BaseCcCountryPeer
|
||||||
|
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
BaseCcCountryPeer::buildTableMap();
|
||||||
|
|
196
airtime_mvc/application/models/airtime/om/BaseCcCountryQuery.php
Normal file
196
airtime_mvc/application/models/airtime/om/BaseCcCountryQuery.php
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'cc_country' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method CcCountryQuery orderByDbIsoCode($order = Criteria::ASC) Order by the isocode column
|
||||||
|
* @method CcCountryQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
||||||
|
*
|
||||||
|
* @method CcCountryQuery groupByDbIsoCode() Group by the isocode column
|
||||||
|
* @method CcCountryQuery groupByDbName() Group by the name column
|
||||||
|
*
|
||||||
|
* @method CcCountryQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method CcCountryQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method CcCountryQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method CcCountry findOne(PropelPDO $con = null) Return the first CcCountry matching the query
|
||||||
|
* @method CcCountry findOneOrCreate(PropelPDO $con = null) Return the first CcCountry matching the query, or a new CcCountry object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method CcCountry findOneByDbIsoCode(string $isocode) Return the first CcCountry filtered by the isocode column
|
||||||
|
* @method CcCountry findOneByDbName(string $name) Return the first CcCountry filtered by the name column
|
||||||
|
*
|
||||||
|
* @method array findByDbIsoCode(string $isocode) Return CcCountry objects filtered by the isocode column
|
||||||
|
* @method array findByDbName(string $name) Return CcCountry objects filtered by the name column
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcCountryQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCcCountryQuery 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 = 'CcCountry', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new CcCountryQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return CcCountryQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof CcCountryQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new CcCountryQuery();
|
||||||
|
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 CcCountry|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ((null !== ($obj = CcCountryPeer::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 CcCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(CcCountryPeer::ISOCODE, $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 CcCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(CcCountryPeer::ISOCODE, $keys, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the isocode column
|
||||||
|
*
|
||||||
|
* @param string $dbIsoCode 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 CcCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByDbIsoCode($dbIsoCode = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($dbIsoCode)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $dbIsoCode)) {
|
||||||
|
$dbIsoCode = str_replace('*', '%', $dbIsoCode);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcCountryPeer::ISOCODE, $dbIsoCode, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the name column
|
||||||
|
*
|
||||||
|
* @param string $dbName The value to use as filter.
|
||||||
|
* Accepts wildcards (* and % trigger a LIKE)
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcCountryQuery 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(CcCountryPeer::NAME, $dbName, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param CcCountry $ccCountry Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return CcCountryQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($ccCountry = null)
|
||||||
|
{
|
||||||
|
if ($ccCountry) {
|
||||||
|
$this->addUsingAlias(CcCountryPeer::ISOCODE, $ccCountry->getDbIsoCode(), Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // BaseCcCountryQuery
|
File diff suppressed because it is too large
Load diff
|
@ -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 = 54;
|
const NUM_COLUMNS = 55;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
@ -46,6 +46,9 @@ abstract class BaseCcFilesPeer {
|
||||||
/** the column name for the FTYPE field */
|
/** the column name for the FTYPE field */
|
||||||
const FTYPE = 'cc_files.FTYPE';
|
const FTYPE = 'cc_files.FTYPE';
|
||||||
|
|
||||||
|
/** the column name for the DIRECTORY field */
|
||||||
|
const DIRECTORY = 'cc_files.DIRECTORY';
|
||||||
|
|
||||||
/** the column name for the FILEPATH field */
|
/** the column name for the FILEPATH field */
|
||||||
const FILEPATH = 'cc_files.FILEPATH';
|
const FILEPATH = 'cc_files.FILEPATH';
|
||||||
|
|
||||||
|
@ -209,12 +212,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', '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', ),
|
||||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbGunid', 'dbName', 'dbMime', 'dbFtype', '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', ),
|
||||||
BasePeer::TYPE_COLNAME => array (self::ID, self::GUNID, self::NAME, self::MIME, self::FTYPE, 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, ),
|
||||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'GUNID', 'NAME', 'MIME', 'FTYPE', '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', ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('id', 'gunid', 'name', 'mime', 'ftype', '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', ),
|
||||||
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, )
|
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, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,12 +227,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, 'DbFilepath' => 5, 'DbState' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbMd5' => 10, 'DbTrackTitle' => 11, 'DbArtistName' => 12, 'DbBitRate' => 13, 'DbSampleRate' => 14, 'DbFormat' => 15, 'DbLength' => 16, 'DbAlbumTitle' => 17, 'DbGenre' => 18, 'DbComments' => 19, 'DbYear' => 20, 'DbTrackNumber' => 21, 'DbChannels' => 22, 'DbUrl' => 23, 'DbBpm' => 24, 'DbRating' => 25, 'DbEncodedBy' => 26, 'DbDiscNumber' => 27, 'DbMood' => 28, 'DbLabel' => 29, 'DbComposer' => 30, 'DbEncoder' => 31, 'DbChecksum' => 32, 'DbLyrics' => 33, 'DbOrchestra' => 34, 'DbConductor' => 35, 'DbLyricist' => 36, 'DbOriginalLyricist' => 37, 'DbRadioStationName' => 38, 'DbInfoUrl' => 39, 'DbArtistUrl' => 40, 'DbAudioSourceUrl' => 41, 'DbRadioStationUrl' => 42, 'DbBuyThisUrl' => 43, 'DbIsrcNumber' => 44, 'DbCatalogNumber' => 45, 'DbOriginalArtist' => 46, 'DbCopyright' => 47, 'DbReportDatetime' => 48, 'DbReportLocation' => 49, 'DbReportOrganization' => 50, 'DbSubject' => 51, 'DbContributor' => 52, 'DbLanguage' => 53, ),
|
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_STUDLYPHPNAME => array ('dbId' => 0, 'dbGunid' => 1, 'dbName' => 2, 'dbMime' => 3, 'dbFtype' => 4, 'dbFilepath' => 5, 'dbState' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbMd5' => 10, 'dbTrackTitle' => 11, 'dbArtistName' => 12, 'dbBitRate' => 13, 'dbSampleRate' => 14, 'dbFormat' => 15, 'dbLength' => 16, 'dbAlbumTitle' => 17, 'dbGenre' => 18, 'dbComments' => 19, 'dbYear' => 20, 'dbTrackNumber' => 21, 'dbChannels' => 22, 'dbUrl' => 23, 'dbBpm' => 24, 'dbRating' => 25, 'dbEncodedBy' => 26, 'dbDiscNumber' => 27, 'dbMood' => 28, 'dbLabel' => 29, 'dbComposer' => 30, 'dbEncoder' => 31, 'dbChecksum' => 32, 'dbLyrics' => 33, 'dbOrchestra' => 34, 'dbConductor' => 35, 'dbLyricist' => 36, 'dbOriginalLyricist' => 37, 'dbRadioStationName' => 38, 'dbInfoUrl' => 39, 'dbArtistUrl' => 40, 'dbAudioSourceUrl' => 41, 'dbRadioStationUrl' => 42, 'dbBuyThisUrl' => 43, 'dbIsrcNumber' => 44, 'dbCatalogNumber' => 45, 'dbOriginalArtist' => 46, 'dbCopyright' => 47, 'dbReportDatetime' => 48, 'dbReportLocation' => 49, 'dbReportOrganization' => 50, 'dbSubject' => 51, 'dbContributor' => 52, 'dbLanguage' => 53, ),
|
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_COLNAME => array (self::ID => 0, self::GUNID => 1, self::NAME => 2, self::MIME => 3, self::FTYPE => 4, self::FILEPATH => 5, self::STATE => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::MD5 => 10, self::TRACK_TITLE => 11, self::ARTIST_NAME => 12, self::BIT_RATE => 13, self::SAMPLE_RATE => 14, self::FORMAT => 15, self::LENGTH => 16, self::ALBUM_TITLE => 17, self::GENRE => 18, self::COMMENTS => 19, self::YEAR => 20, self::TRACK_NUMBER => 21, self::CHANNELS => 22, self::URL => 23, self::BPM => 24, self::RATING => 25, self::ENCODED_BY => 26, self::DISC_NUMBER => 27, self::MOOD => 28, self::LABEL => 29, self::COMPOSER => 30, self::ENCODER => 31, self::CHECKSUM => 32, self::LYRICS => 33, self::ORCHESTRA => 34, self::CONDUCTOR => 35, self::LYRICIST => 36, self::ORIGINAL_LYRICIST => 37, self::RADIO_STATION_NAME => 38, self::INFO_URL => 39, self::ARTIST_URL => 40, self::AUDIO_SOURCE_URL => 41, self::RADIO_STATION_URL => 42, self::BUY_THIS_URL => 43, self::ISRC_NUMBER => 44, self::CATALOG_NUMBER => 45, self::ORIGINAL_ARTIST => 46, self::COPYRIGHT => 47, self::REPORT_DATETIME => 48, self::REPORT_LOCATION => 49, self::REPORT_ORGANIZATION => 50, self::SUBJECT => 51, self::CONTRIBUTOR => 52, self::LANGUAGE => 53, ),
|
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_RAW_COLNAME => array ('ID' => 0, 'GUNID' => 1, 'NAME' => 2, 'MIME' => 3, 'FTYPE' => 4, 'FILEPATH' => 5, 'STATE' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'MD5' => 10, 'TRACK_TITLE' => 11, 'ARTIST_NAME' => 12, 'BIT_RATE' => 13, 'SAMPLE_RATE' => 14, 'FORMAT' => 15, 'LENGTH' => 16, 'ALBUM_TITLE' => 17, 'GENRE' => 18, 'COMMENTS' => 19, 'YEAR' => 20, 'TRACK_NUMBER' => 21, 'CHANNELS' => 22, 'URL' => 23, 'BPM' => 24, 'RATING' => 25, 'ENCODED_BY' => 26, 'DISC_NUMBER' => 27, 'MOOD' => 28, 'LABEL' => 29, 'COMPOSER' => 30, 'ENCODER' => 31, 'CHECKSUM' => 32, 'LYRICS' => 33, 'ORCHESTRA' => 34, 'CONDUCTOR' => 35, 'LYRICIST' => 36, 'ORIGINAL_LYRICIST' => 37, 'RADIO_STATION_NAME' => 38, 'INFO_URL' => 39, 'ARTIST_URL' => 40, 'AUDIO_SOURCE_URL' => 41, 'RADIO_STATION_URL' => 42, 'BUY_THIS_URL' => 43, 'ISRC_NUMBER' => 44, 'CATALOG_NUMBER' => 45, 'ORIGINAL_ARTIST' => 46, 'COPYRIGHT' => 47, 'REPORT_DATETIME' => 48, 'REPORT_LOCATION' => 49, 'REPORT_ORGANIZATION' => 50, 'SUBJECT' => 51, 'CONTRIBUTOR' => 52, 'LANGUAGE' => 53, ),
|
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_FIELDNAME => array ('id' => 0, 'gunid' => 1, 'name' => 2, 'mime' => 3, 'ftype' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'md5' => 10, 'track_title' => 11, 'artist_name' => 12, 'bit_rate' => 13, 'sample_rate' => 14, 'format' => 15, 'length' => 16, 'album_title' => 17, 'genre' => 18, 'comments' => 19, 'year' => 20, 'track_number' => 21, 'channels' => 22, 'url' => 23, 'bpm' => 24, 'rating' => 25, 'encoded_by' => 26, 'disc_number' => 27, 'mood' => 28, 'label' => 29, 'composer' => 30, 'encoder' => 31, 'checksum' => 32, 'lyrics' => 33, 'orchestra' => 34, 'conductor' => 35, 'lyricist' => 36, 'original_lyricist' => 37, 'radio_station_name' => 38, 'info_url' => 39, 'artist_url' => 40, 'audio_source_url' => 41, 'radio_station_url' => 42, 'buy_this_url' => 43, 'isrc_number' => 44, 'catalog_number' => 45, 'original_artist' => 46, 'copyright' => 47, 'report_datetime' => 48, 'report_location' => 49, 'report_organization' => 50, 'subject' => 51, 'contributor' => 52, 'language' => 53, ),
|
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_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, )
|
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, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,6 +309,7 @@ abstract class BaseCcFilesPeer {
|
||||||
$criteria->addSelectColumn(CcFilesPeer::NAME);
|
$criteria->addSelectColumn(CcFilesPeer::NAME);
|
||||||
$criteria->addSelectColumn(CcFilesPeer::MIME);
|
$criteria->addSelectColumn(CcFilesPeer::MIME);
|
||||||
$criteria->addSelectColumn(CcFilesPeer::FTYPE);
|
$criteria->addSelectColumn(CcFilesPeer::FTYPE);
|
||||||
|
$criteria->addSelectColumn(CcFilesPeer::DIRECTORY);
|
||||||
$criteria->addSelectColumn(CcFilesPeer::FILEPATH);
|
$criteria->addSelectColumn(CcFilesPeer::FILEPATH);
|
||||||
$criteria->addSelectColumn(CcFilesPeer::STATE);
|
$criteria->addSelectColumn(CcFilesPeer::STATE);
|
||||||
$criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING);
|
$criteria->addSelectColumn(CcFilesPeer::CURRENTLYACCESSING);
|
||||||
|
@ -361,6 +365,7 @@ abstract class BaseCcFilesPeer {
|
||||||
$criteria->addSelectColumn($alias . '.NAME');
|
$criteria->addSelectColumn($alias . '.NAME');
|
||||||
$criteria->addSelectColumn($alias . '.MIME');
|
$criteria->addSelectColumn($alias . '.MIME');
|
||||||
$criteria->addSelectColumn($alias . '.FTYPE');
|
$criteria->addSelectColumn($alias . '.FTYPE');
|
||||||
|
$criteria->addSelectColumn($alias . '.DIRECTORY');
|
||||||
$criteria->addSelectColumn($alias . '.FILEPATH');
|
$criteria->addSelectColumn($alias . '.FILEPATH');
|
||||||
$criteria->addSelectColumn($alias . '.STATE');
|
$criteria->addSelectColumn($alias . '.STATE');
|
||||||
$criteria->addSelectColumn($alias . '.CURRENTLYACCESSING');
|
$criteria->addSelectColumn($alias . '.CURRENTLYACCESSING');
|
||||||
|
@ -609,6 +614,9 @@ abstract class BaseCcFilesPeer {
|
||||||
// Invalidate objects in CcPlaylistcontentsPeer instance pool,
|
// Invalidate objects in CcPlaylistcontentsPeer instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
CcPlaylistcontentsPeer::clearInstancePool();
|
CcPlaylistcontentsPeer::clearInstancePool();
|
||||||
|
// Invalidate objects in CcSchedulePeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
CcSchedulePeer::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -751,6 +759,56 @@ abstract class BaseCcFilesPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria, joining the related CcMusicDirs table
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCountJoinCcMusicDirs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
// we're going to modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$count = (int) $row[0];
|
||||||
|
} else {
|
||||||
|
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects a collection of CcFiles objects pre-filled with their CcSubjs objects.
|
* Selects a collection of CcFiles objects pre-filled with their CcSubjs objects.
|
||||||
* @param Criteria $criteria
|
* @param Criteria $criteria
|
||||||
|
@ -817,6 +875,72 @@ abstract class BaseCcFilesPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcFiles objects pre-filled with their CcMusicDirs objects.
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return array Array of CcFiles objects.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doSelectJoinCcMusicDirs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// Set the correct dbName if it has not been overridden
|
||||||
|
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
CcMusicDirsPeer::addSelectColumns($criteria);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj1->hydrate($row, 0, true); // rehydrate
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj1 = new $cls();
|
||||||
|
$obj1->hydrate($row);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj1, $key1);
|
||||||
|
} // if $obj1 already loaded
|
||||||
|
|
||||||
|
$key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||||
|
if ($key2 !== null) {
|
||||||
|
$obj2 = CcMusicDirsPeer::getInstanceFromPool($key2);
|
||||||
|
if (!$obj2) {
|
||||||
|
|
||||||
|
$cls = CcMusicDirsPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj2 = new $cls();
|
||||||
|
$obj2->hydrate($row, $startcol);
|
||||||
|
CcMusicDirsPeer::addInstanceToPool($obj2, $key2);
|
||||||
|
} // if obj2 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcFiles) to $obj2 (CcMusicDirs)
|
||||||
|
$obj2->addCcFiles($obj1);
|
||||||
|
|
||||||
|
} // if joined row was not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows matching criteria, joining all related tables
|
* Returns the number of rows matching criteria, joining all related tables
|
||||||
*
|
*
|
||||||
|
@ -855,6 +979,8 @@ abstract class BaseCcFilesPeer {
|
||||||
|
|
||||||
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
$stmt = BasePeer::doCount($criteria, $con);
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
@ -891,8 +1017,13 @@ abstract class BaseCcFilesPeer {
|
||||||
CcSubjsPeer::addSelectColumns($criteria);
|
CcSubjsPeer::addSelectColumns($criteria);
|
||||||
$startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
|
$startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcMusicDirsPeer::addSelectColumns($criteria);
|
||||||
|
$startcol4 = $startcol3 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
$stmt = BasePeer::doSelect($criteria, $con);
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
|
@ -928,6 +1059,270 @@ abstract class BaseCcFilesPeer {
|
||||||
$obj2->addCcFiles($obj1);
|
$obj2->addCcFiles($obj1);
|
||||||
} // if joined row not null
|
} // if joined row not null
|
||||||
|
|
||||||
|
// Add objects for joined CcMusicDirs rows
|
||||||
|
|
||||||
|
$key3 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||||
|
if ($key3 !== null) {
|
||||||
|
$obj3 = CcMusicDirsPeer::getInstanceFromPool($key3);
|
||||||
|
if (!$obj3) {
|
||||||
|
|
||||||
|
$cls = CcMusicDirsPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj3 = new $cls();
|
||||||
|
$obj3->hydrate($row, $startcol3);
|
||||||
|
CcMusicDirsPeer::addInstanceToPool($obj3, $key3);
|
||||||
|
} // if obj3 loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcFiles) to the collection in $obj3 (CcMusicDirs)
|
||||||
|
$obj3->addCcFiles($obj1);
|
||||||
|
} // if joined row not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria, joining the related CcSubjs table
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCountJoinAllExceptCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
// we're going to modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$count = (int) $row[0];
|
||||||
|
} else {
|
||||||
|
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria, joining the related CcMusicDirs table
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCountJoinAllExceptCcMusicDirs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
// we're going to modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(CcFilesPeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$count = (int) $row[0];
|
||||||
|
} else {
|
||||||
|
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcFiles objects pre-filled with all related objects except CcSubjs.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return array Array of CcFiles objects.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doSelectJoinAllExceptCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// Set the correct dbName if it has not been overridden
|
||||||
|
// $criteria->getDbName() will return the same object if not set to another value
|
||||||
|
// so == check is okay and faster
|
||||||
|
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol2 = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcMusicDirsPeer::addSelectColumns($criteria);
|
||||||
|
$startcol3 = $startcol2 + (CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::DIRECTORY, CcMusicDirsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
|
||||||
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj1->hydrate($row, 0, true); // rehydrate
|
||||||
|
} else {
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj1 = new $cls();
|
||||||
|
$obj1->hydrate($row);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj1, $key1);
|
||||||
|
} // if obj1 already loaded
|
||||||
|
|
||||||
|
// Add objects for joined CcMusicDirs rows
|
||||||
|
|
||||||
|
$key2 = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||||
|
if ($key2 !== null) {
|
||||||
|
$obj2 = CcMusicDirsPeer::getInstanceFromPool($key2);
|
||||||
|
if (!$obj2) {
|
||||||
|
|
||||||
|
$cls = CcMusicDirsPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj2 = new $cls();
|
||||||
|
$obj2->hydrate($row, $startcol2);
|
||||||
|
CcMusicDirsPeer::addInstanceToPool($obj2, $key2);
|
||||||
|
} // if $obj2 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcFiles) to the collection in $obj2 (CcMusicDirs)
|
||||||
|
$obj2->addCcFiles($obj1);
|
||||||
|
|
||||||
|
} // if joined row is not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcFiles objects pre-filled with all related objects except CcMusicDirs.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return array Array of CcFiles objects.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doSelectJoinAllExceptCcMusicDirs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// Set the correct dbName if it has not been overridden
|
||||||
|
// $criteria->getDbName() will return the same object if not set to another value
|
||||||
|
// so == check is okay and faster
|
||||||
|
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol2 = (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcSubjsPeer::addSelectColumns($criteria);
|
||||||
|
$startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcFilesPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
|
||||||
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key1 = CcFilesPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj1 = CcFilesPeer::getInstanceFromPool($key1))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj1->hydrate($row, 0, true); // rehydrate
|
||||||
|
} else {
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj1 = new $cls();
|
||||||
|
$obj1->hydrate($row);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj1, $key1);
|
||||||
|
} // if obj1 already loaded
|
||||||
|
|
||||||
|
// Add objects for joined CcSubjs rows
|
||||||
|
|
||||||
|
$key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||||
|
if ($key2 !== null) {
|
||||||
|
$obj2 = CcSubjsPeer::getInstanceFromPool($key2);
|
||||||
|
if (!$obj2) {
|
||||||
|
|
||||||
|
$cls = CcSubjsPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj2 = new $cls();
|
||||||
|
$obj2->hydrate($row, $startcol2);
|
||||||
|
CcSubjsPeer::addInstanceToPool($obj2, $key2);
|
||||||
|
} // if $obj2 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcFiles) to the collection in $obj2 (CcSubjs)
|
||||||
|
$obj2->addCcFiles($obj1);
|
||||||
|
|
||||||
|
} // if joined row is not null
|
||||||
|
|
||||||
$results[] = $obj1;
|
$results[] = $obj1;
|
||||||
}
|
}
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
* @method CcFilesQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
* @method CcFilesQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
||||||
* @method CcFilesQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
|
* @method CcFilesQuery orderByDbMime($order = Criteria::ASC) Order by the mime column
|
||||||
* @method CcFilesQuery orderByDbFtype($order = Criteria::ASC) Order by the ftype column
|
* @method CcFilesQuery orderByDbFtype($order = Criteria::ASC) Order by the ftype column
|
||||||
|
* @method CcFilesQuery orderByDbDirectory($order = Criteria::ASC) Order by the directory column
|
||||||
* @method CcFilesQuery orderByDbFilepath($order = Criteria::ASC) Order by the filepath column
|
* @method CcFilesQuery orderByDbFilepath($order = Criteria::ASC) Order by the filepath column
|
||||||
* @method CcFilesQuery orderByDbState($order = Criteria::ASC) Order by the state column
|
* @method CcFilesQuery orderByDbState($order = Criteria::ASC) Order by the state column
|
||||||
* @method CcFilesQuery orderByDbCurrentlyaccessing($order = Criteria::ASC) Order by the currentlyaccessing column
|
* @method CcFilesQuery orderByDbCurrentlyaccessing($order = Criteria::ASC) Order by the currentlyaccessing column
|
||||||
|
@ -66,6 +67,7 @@
|
||||||
* @method CcFilesQuery groupByDbName() Group by the name column
|
* @method CcFilesQuery groupByDbName() Group by the name column
|
||||||
* @method CcFilesQuery groupByDbMime() Group by the mime column
|
* @method CcFilesQuery groupByDbMime() Group by the mime column
|
||||||
* @method CcFilesQuery groupByDbFtype() Group by the ftype column
|
* @method CcFilesQuery groupByDbFtype() Group by the ftype column
|
||||||
|
* @method CcFilesQuery groupByDbDirectory() Group by the directory column
|
||||||
* @method CcFilesQuery groupByDbFilepath() Group by the filepath column
|
* @method CcFilesQuery groupByDbFilepath() Group by the filepath column
|
||||||
* @method CcFilesQuery groupByDbState() Group by the state column
|
* @method CcFilesQuery groupByDbState() Group by the state column
|
||||||
* @method CcFilesQuery groupByDbCurrentlyaccessing() Group by the currentlyaccessing column
|
* @method CcFilesQuery groupByDbCurrentlyaccessing() Group by the currentlyaccessing column
|
||||||
|
@ -124,6 +126,10 @@
|
||||||
* @method CcFilesQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
|
* @method CcFilesQuery rightJoinCcSubjs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSubjs relation
|
||||||
* @method CcFilesQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
|
* @method CcFilesQuery innerJoinCcSubjs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSubjs relation
|
||||||
*
|
*
|
||||||
|
* @method CcFilesQuery leftJoinCcMusicDirs($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcMusicDirs relation
|
||||||
|
* @method CcFilesQuery rightJoinCcMusicDirs($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcMusicDirs relation
|
||||||
|
* @method CcFilesQuery innerJoinCcMusicDirs($relationAlias = '') Adds a INNER JOIN clause to the query using the CcMusicDirs relation
|
||||||
|
*
|
||||||
* @method CcFilesQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
|
* @method CcFilesQuery leftJoinCcShowInstances($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcShowInstances relation
|
||||||
* @method CcFilesQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
|
* @method CcFilesQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
|
||||||
* @method CcFilesQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
|
* @method CcFilesQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
|
||||||
|
@ -132,6 +138,10 @@
|
||||||
* @method CcFilesQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
|
* @method CcFilesQuery rightJoinCcPlaylistcontents($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcPlaylistcontents relation
|
||||||
* @method CcFilesQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
|
* @method CcFilesQuery innerJoinCcPlaylistcontents($relationAlias = '') Adds a INNER JOIN clause to the query using the CcPlaylistcontents relation
|
||||||
*
|
*
|
||||||
|
* @method CcFilesQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
|
||||||
|
* @method CcFilesQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
|
||||||
|
* @method CcFilesQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
|
||||||
|
*
|
||||||
* @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
|
* @method CcFiles findOne(PropelPDO $con = null) Return the first CcFiles matching the query
|
||||||
* @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
|
* @method CcFiles findOneOrCreate(PropelPDO $con = null) Return the first CcFiles matching the query, or a new CcFiles object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
|
@ -140,6 +150,7 @@
|
||||||
* @method CcFiles findOneByDbName(string $name) Return the first CcFiles filtered by the name column
|
* @method CcFiles findOneByDbName(string $name) Return the first CcFiles filtered by the name column
|
||||||
* @method CcFiles findOneByDbMime(string $mime) Return the first CcFiles filtered by the mime column
|
* @method CcFiles findOneByDbMime(string $mime) Return the first CcFiles filtered by the mime column
|
||||||
* @method CcFiles findOneByDbFtype(string $ftype) Return the first CcFiles filtered by the ftype column
|
* @method CcFiles findOneByDbFtype(string $ftype) Return the first CcFiles filtered by the ftype column
|
||||||
|
* @method CcFiles findOneByDbDirectory(int $directory) Return the first CcFiles filtered by the directory column
|
||||||
* @method CcFiles findOneByDbFilepath(string $filepath) Return the first CcFiles filtered by the filepath column
|
* @method CcFiles findOneByDbFilepath(string $filepath) Return the first CcFiles filtered by the filepath column
|
||||||
* @method CcFiles findOneByDbState(string $state) Return the first CcFiles filtered by the state column
|
* @method CcFiles findOneByDbState(string $state) Return the first CcFiles filtered by the state column
|
||||||
* @method CcFiles findOneByDbCurrentlyaccessing(int $currentlyaccessing) Return the first CcFiles filtered by the currentlyaccessing column
|
* @method CcFiles findOneByDbCurrentlyaccessing(int $currentlyaccessing) Return the first CcFiles filtered by the currentlyaccessing column
|
||||||
|
@ -195,6 +206,7 @@
|
||||||
* @method array findByDbName(string $name) Return CcFiles objects filtered by the name column
|
* @method array findByDbName(string $name) Return CcFiles objects filtered by the name column
|
||||||
* @method array findByDbMime(string $mime) Return CcFiles objects filtered by the mime column
|
* @method array findByDbMime(string $mime) Return CcFiles objects filtered by the mime column
|
||||||
* @method array findByDbFtype(string $ftype) Return CcFiles objects filtered by the ftype column
|
* @method array findByDbFtype(string $ftype) Return CcFiles objects filtered by the ftype column
|
||||||
|
* @method array findByDbDirectory(int $directory) Return CcFiles objects filtered by the directory column
|
||||||
* @method array findByDbFilepath(string $filepath) Return CcFiles objects filtered by the filepath column
|
* @method array findByDbFilepath(string $filepath) Return CcFiles objects filtered by the filepath column
|
||||||
* @method array findByDbState(string $state) Return CcFiles objects filtered by the state column
|
* @method array findByDbState(string $state) Return CcFiles objects filtered by the state column
|
||||||
* @method array findByDbCurrentlyaccessing(int $currentlyaccessing) Return CcFiles objects filtered by the currentlyaccessing column
|
* @method array findByDbCurrentlyaccessing(int $currentlyaccessing) Return CcFiles objects filtered by the currentlyaccessing column
|
||||||
|
@ -458,6 +470,37 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
||||||
return $this->addUsingAlias(CcFilesPeer::FTYPE, $dbFtype, $comparison);
|
return $this->addUsingAlias(CcFilesPeer::FTYPE, $dbFtype, $comparison);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the directory column
|
||||||
|
*
|
||||||
|
* @param int|array $dbDirectory 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 filterByDbDirectory($dbDirectory = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($dbDirectory)) {
|
||||||
|
$useMinMax = false;
|
||||||
|
if (isset($dbDirectory['min'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory['min'], Criteria::GREATER_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if (isset($dbDirectory['max'])) {
|
||||||
|
$this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory['max'], Criteria::LESS_EQUAL);
|
||||||
|
$useMinMax = true;
|
||||||
|
}
|
||||||
|
if ($useMinMax) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
if (null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcFilesPeer::DIRECTORY, $dbDirectory, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query on the filepath column
|
* Filter the query on the filepath column
|
||||||
*
|
*
|
||||||
|
@ -1654,6 +1697,70 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
||||||
->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CcSubjs', 'CcSubjsQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related CcMusicDirs object
|
||||||
|
*
|
||||||
|
* @param CcMusicDirs $ccMusicDirs the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCcMusicDirs($ccMusicDirs, $comparison = null)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CcFilesPeer::DIRECTORY, $ccMusicDirs->getId(), $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CcMusicDirs relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCcMusicDirs($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CcMusicDirs');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'CcMusicDirs');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CcMusicDirs relation CcMusicDirs object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcMusicDirsQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCcMusicDirsQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCcMusicDirs($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CcMusicDirs', 'CcMusicDirsQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter the query by a related CcShowInstances object
|
* Filter the query by a related CcShowInstances object
|
||||||
*
|
*
|
||||||
|
@ -1782,6 +1889,70 @@ abstract class BaseCcFilesQuery extends ModelCriteria
|
||||||
->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CcPlaylistcontents', 'CcPlaylistcontentsQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related CcSchedule object
|
||||||
|
*
|
||||||
|
* @param CcSchedule $ccSchedule the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCcSchedule($ccSchedule, $comparison = null)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CcFilesPeer::ID, $ccSchedule->getDbFileId(), $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CcSchedule relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcFilesQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCcSchedule($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CcSchedule');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'CcSchedule');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CcSchedule relation CcSchedule object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcScheduleQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCcScheduleQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCcSchedule($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|
941
airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php
Normal file
941
airtime_mvc/application/models/airtime/om/BaseCcMusicDirs.php
Normal file
|
@ -0,0 +1,941 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a row from the 'cc_music_dirs' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcMusicDirs extends BaseObject implements Persistent
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer class name
|
||||||
|
*/
|
||||||
|
const PEER = 'CcMusicDirsPeer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 CcMusicDirsPeer
|
||||||
|
*/
|
||||||
|
protected static $peer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the id field.
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the directory field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $directory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value for the type field.
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array CcFiles[] Collection to store aggregation of CcFiles objects.
|
||||||
|
*/
|
||||||
|
protected $collCcFiless;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 [id] column value.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [directory] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDirectory()
|
||||||
|
{
|
||||||
|
return $this->directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the [type] column value.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getType()
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [id] column.
|
||||||
|
*
|
||||||
|
* @param int $v new value
|
||||||
|
* @return CcMusicDirs The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setId($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (int) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->id !== $v) {
|
||||||
|
$this->id = $v;
|
||||||
|
$this->modifiedColumns[] = CcMusicDirsPeer::ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setId()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [directory] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcMusicDirs The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setDirectory($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->directory !== $v) {
|
||||||
|
$this->directory = $v;
|
||||||
|
$this->modifiedColumns[] = CcMusicDirsPeer::DIRECTORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setDirectory()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of [type] column.
|
||||||
|
*
|
||||||
|
* @param string $v new value
|
||||||
|
* @return CcMusicDirs The current object (for fluent API support)
|
||||||
|
*/
|
||||||
|
public function setType($v)
|
||||||
|
{
|
||||||
|
if ($v !== null) {
|
||||||
|
$v = (string) $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->type !== $v) {
|
||||||
|
$this->type = $v;
|
||||||
|
$this->modifiedColumns[] = CcMusicDirsPeer::TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
} // setType()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the columns in this object are only set to default values.
|
||||||
|
*
|
||||||
|
* This method can be used in conjunction with isModified() to indicate whether an object is both
|
||||||
|
* modified _and_ has some values set which are non-default.
|
||||||
|
*
|
||||||
|
* @return boolean Whether the columns in this object are only been set with default values.
|
||||||
|
*/
|
||||||
|
public function hasOnlyDefaultValues()
|
||||||
|
{
|
||||||
|
// otherwise, everything was equal, so return TRUE
|
||||||
|
return true;
|
||||||
|
} // hasOnlyDefaultValues()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hydrates (populates) the object variables with values from the database resultset.
|
||||||
|
*
|
||||||
|
* An offset (0-based "start column") is specified so that objects can be hydrated
|
||||||
|
* with a subset of the columns in the resultset rows. This is needed, for example,
|
||||||
|
* for results of JOIN queries where the resultset row includes columns from two or
|
||||||
|
* more tables.
|
||||||
|
*
|
||||||
|
* @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
|
||||||
|
* @param int $startcol 0-based offset column which indicates which restultset column to start with.
|
||||||
|
* @param boolean $rehydrate Whether this object is being re-hydrated from the database.
|
||||||
|
* @return int next starting column
|
||||||
|
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
|
||||||
|
*/
|
||||||
|
public function hydrate($row, $startcol = 0, $rehydrate = false)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
|
||||||
|
$this->directory = ($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 = CcMusicDirsPeer::NUM_COLUMNS - CcMusicDirsPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new PropelException("Error populating CcMusicDirs 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(CcMusicDirsPeer::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 = CcMusicDirsPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
|
||||||
|
$row = $stmt->fetch(PDO::FETCH_NUM);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
if (!$row) {
|
||||||
|
throw new PropelException('Cannot find matching row in the database to reload object values.');
|
||||||
|
}
|
||||||
|
$this->hydrate($row, 0, true); // rehydrate
|
||||||
|
|
||||||
|
if ($deep) { // also de-associate any related objects?
|
||||||
|
|
||||||
|
$this->collCcFiless = null;
|
||||||
|
|
||||||
|
} // if (deep)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes this object from datastore and sets delete attribute.
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
* @see BaseObject::setDeleted()
|
||||||
|
* @see BaseObject::isDeleted()
|
||||||
|
*/
|
||||||
|
public function delete(PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
if ($this->isDeleted()) {
|
||||||
|
throw new PropelException("This object has already been deleted.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$con->beginTransaction();
|
||||||
|
try {
|
||||||
|
$ret = $this->preDelete($con);
|
||||||
|
if ($ret) {
|
||||||
|
CcMusicDirsQuery::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(CcMusicDirsPeer::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);
|
||||||
|
CcMusicDirsPeer::addInstanceToPool($this);
|
||||||
|
} else {
|
||||||
|
$affectedRows = 0;
|
||||||
|
}
|
||||||
|
$con->commit();
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the work of inserting or updating the row in the database.
|
||||||
|
*
|
||||||
|
* If the object is new, it inserts it; otherwise an update is performed.
|
||||||
|
* All related objects are also updated in this method.
|
||||||
|
*
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
|
||||||
|
* @throws PropelException
|
||||||
|
* @see save()
|
||||||
|
*/
|
||||||
|
protected function doSave(PropelPDO $con)
|
||||||
|
{
|
||||||
|
$affectedRows = 0; // initialize var to track total num of affected rows
|
||||||
|
if (!$this->alreadyInSave) {
|
||||||
|
$this->alreadyInSave = true;
|
||||||
|
|
||||||
|
if ($this->isNew() ) {
|
||||||
|
$this->modifiedColumns[] = CcMusicDirsPeer::ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If this object has been modified, then save it to the database.
|
||||||
|
if ($this->isModified()) {
|
||||||
|
if ($this->isNew()) {
|
||||||
|
$criteria = $this->buildCriteria();
|
||||||
|
if ($criteria->keyContainsValue(CcMusicDirsPeer::ID) ) {
|
||||||
|
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMusicDirsPeer::ID.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
$pk = BasePeer::doInsert($criteria, $con);
|
||||||
|
$affectedRows = 1;
|
||||||
|
$this->setId($pk); //[IMV] update autoincrement primary key
|
||||||
|
$this->setNew(false);
|
||||||
|
} else {
|
||||||
|
$affectedRows = CcMusicDirsPeer::doUpdate($this, $con);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->collCcFiless !== null) {
|
||||||
|
foreach ($this->collCcFiless as $referrerFK) {
|
||||||
|
if (!$referrerFK->isDeleted()) {
|
||||||
|
$affectedRows += $referrerFK->save($con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->alreadyInSave = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
return $affectedRows;
|
||||||
|
} // doSave()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of ValidationFailed objects.
|
||||||
|
* @var array ValidationFailed[]
|
||||||
|
*/
|
||||||
|
protected $validationFailures = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets any ValidationFailed objects that resulted from last call to validate().
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return array ValidationFailed[]
|
||||||
|
* @see validate()
|
||||||
|
*/
|
||||||
|
public function getValidationFailures()
|
||||||
|
{
|
||||||
|
return $this->validationFailures;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the objects modified field values and all objects related to this table.
|
||||||
|
*
|
||||||
|
* If $columns is either a column name or an array of column names
|
||||||
|
* only those columns are validated.
|
||||||
|
*
|
||||||
|
* @param mixed $columns Column name or an array of column names.
|
||||||
|
* @return boolean Whether all columns pass validation.
|
||||||
|
* @see doValidate()
|
||||||
|
* @see getValidationFailures()
|
||||||
|
*/
|
||||||
|
public function validate($columns = null)
|
||||||
|
{
|
||||||
|
$res = $this->doValidate($columns);
|
||||||
|
if ($res === true) {
|
||||||
|
$this->validationFailures = array();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
$this->validationFailures = $res;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs the validation work for complex object models.
|
||||||
|
*
|
||||||
|
* In addition to checking the current object, all related objects will
|
||||||
|
* also be validated. If all pass then <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 = CcMusicDirsPeer::doValidate($this, $columns)) !== true) {
|
||||||
|
$failureMap = array_merge($failureMap, $retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->collCcFiless !== null) {
|
||||||
|
foreach ($this->collCcFiless as $referrerFK) {
|
||||||
|
if (!$referrerFK->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->alreadyInValidation = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (!empty($failureMap) ? $failureMap : true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a field from the object by name passed in as a string.
|
||||||
|
*
|
||||||
|
* @param string $name name
|
||||||
|
* @param string $type The type of fieldname the $name is of:
|
||||||
|
* one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
|
||||||
|
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
|
||||||
|
* @return mixed Value of field.
|
||||||
|
*/
|
||||||
|
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||||
|
{
|
||||||
|
$pos = CcMusicDirsPeer::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->getId();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return $this->getDirectory();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return $this->getType();
|
||||||
|
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 = CcMusicDirsPeer::getFieldNames($keyType);
|
||||||
|
$result = array(
|
||||||
|
$keys[0] => $this->getId(),
|
||||||
|
$keys[1] => $this->getDirectory(),
|
||||||
|
$keys[2] => $this->getType(),
|
||||||
|
);
|
||||||
|
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 = CcMusicDirsPeer::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->setId($value);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$this->setDirectory($value);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$this->setType($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 = CcMusicDirsPeer::getFieldNames($keyType);
|
||||||
|
|
||||||
|
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
|
||||||
|
if (array_key_exists($keys[1], $arr)) $this->setDirectory($arr[$keys[1]]);
|
||||||
|
if (array_key_exists($keys[2], $arr)) $this->setType($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(CcMusicDirsPeer::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($this->isColumnModified(CcMusicDirsPeer::ID)) $criteria->add(CcMusicDirsPeer::ID, $this->id);
|
||||||
|
if ($this->isColumnModified(CcMusicDirsPeer::DIRECTORY)) $criteria->add(CcMusicDirsPeer::DIRECTORY, $this->directory);
|
||||||
|
if ($this->isColumnModified(CcMusicDirsPeer::TYPE)) $criteria->add(CcMusicDirsPeer::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(CcMusicDirsPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(CcMusicDirsPeer::ID, $this->id);
|
||||||
|
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the primary key for this object (row).
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getPrimaryKey()
|
||||||
|
{
|
||||||
|
return $this->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic method to set the primary key (id column).
|
||||||
|
*
|
||||||
|
* @param int $key Primary key.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setPrimaryKey($key)
|
||||||
|
{
|
||||||
|
$this->setId($key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the primary key for this object is null.
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isPrimaryKeyNull()
|
||||||
|
{
|
||||||
|
return null === $this->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 CcMusicDirs (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->setDirectory($this->directory);
|
||||||
|
$copyObj->setType($this->type);
|
||||||
|
|
||||||
|
if ($deepCopy) {
|
||||||
|
// important: temporarily setNew(false) because this affects the behavior of
|
||||||
|
// the getter/setter methods for fkey referrer objects.
|
||||||
|
$copyObj->setNew(false);
|
||||||
|
|
||||||
|
foreach ($this->getCcFiless() as $relObj) {
|
||||||
|
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
|
||||||
|
$copyObj->addCcFiles($relObj->copy($deepCopy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // if ($deepCopy)
|
||||||
|
|
||||||
|
|
||||||
|
$copyObj->setNew(true);
|
||||||
|
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a copy of this object that will be inserted as a new row in table when saved.
|
||||||
|
* It creates a new object filling in the simple attributes, but skipping any primary
|
||||||
|
* keys that are defined for the table.
|
||||||
|
*
|
||||||
|
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||||
|
* objects.
|
||||||
|
*
|
||||||
|
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||||
|
* @return CcMusicDirs 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 CcMusicDirsPeer
|
||||||
|
*/
|
||||||
|
public function getPeer()
|
||||||
|
{
|
||||||
|
if (self::$peer === null) {
|
||||||
|
self::$peer = new CcMusicDirsPeer();
|
||||||
|
}
|
||||||
|
return self::$peer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears out the collCcFiless collection
|
||||||
|
*
|
||||||
|
* This does not modify the database; however, it will remove any associated objects, causing
|
||||||
|
* them to be refetched by subsequent calls to accessor method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @see addCcFiless()
|
||||||
|
*/
|
||||||
|
public function clearCcFiless()
|
||||||
|
{
|
||||||
|
$this->collCcFiless = null; // important to set this to NULL since that means it is uninitialized
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the collCcFiless collection.
|
||||||
|
*
|
||||||
|
* By default this just sets the collCcFiless collection to an empty array (like clearcollCcFiless());
|
||||||
|
* however, you may wish to override this method in your stub class to provide setting appropriate
|
||||||
|
* to your application -- for example, setting the initial array to the values stored in database.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initCcFiless()
|
||||||
|
{
|
||||||
|
$this->collCcFiless = new PropelObjectCollection();
|
||||||
|
$this->collCcFiless->setModel('CcFiles');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an array of CcFiles objects which contain a foreign key that references this object.
|
||||||
|
*
|
||||||
|
* If the $criteria is not null, it is used to always fetch the results from the database.
|
||||||
|
* Otherwise the results are fetched from the database the first time, then cached.
|
||||||
|
* Next time the same method is called without $criteria, the cached collection is returned.
|
||||||
|
* If this CcMusicDirs is new, it will return
|
||||||
|
* an empty collection or the current collection; the criteria is ignored on a new object.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @return PropelCollection|array CcFiles[] List of CcFiles objects
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getCcFiless($criteria = null, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
if(null === $this->collCcFiless || null !== $criteria) {
|
||||||
|
if ($this->isNew() && null === $this->collCcFiless) {
|
||||||
|
// return empty collection
|
||||||
|
$this->initCcFiless();
|
||||||
|
} else {
|
||||||
|
$collCcFiless = CcFilesQuery::create(null, $criteria)
|
||||||
|
->filterByCcMusicDirs($this)
|
||||||
|
->find($con);
|
||||||
|
if (null !== $criteria) {
|
||||||
|
return $collCcFiless;
|
||||||
|
}
|
||||||
|
$this->collCcFiless = $collCcFiless;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->collCcFiless;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of related CcFiles objects.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @return int Count of related CcFiles objects.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function countCcFiless(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
if(null === $this->collCcFiless || null !== $criteria) {
|
||||||
|
if ($this->isNew() && null === $this->collCcFiless) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
$query = CcFilesQuery::create(null, $criteria);
|
||||||
|
if($distinct) {
|
||||||
|
$query->distinct();
|
||||||
|
}
|
||||||
|
return $query
|
||||||
|
->filterByCcMusicDirs($this)
|
||||||
|
->count($con);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return count($this->collCcFiless);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called to associate a CcFiles object to this object
|
||||||
|
* through the CcFiles foreign key attribute.
|
||||||
|
*
|
||||||
|
* @param CcFiles $l CcFiles
|
||||||
|
* @return void
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function addCcFiles(CcFiles $l)
|
||||||
|
{
|
||||||
|
if ($this->collCcFiless === null) {
|
||||||
|
$this->initCcFiless();
|
||||||
|
}
|
||||||
|
if (!$this->collCcFiless->contains($l)) { // only add it if the **same** object is not already associated
|
||||||
|
$this->collCcFiless[]= $l;
|
||||||
|
$l->setCcMusicDirs($this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this CcMusicDirs is new, it will return
|
||||||
|
* an empty collection; or if this CcMusicDirs has previously
|
||||||
|
* been saved, it will retrieve related CcFiless from storage.
|
||||||
|
*
|
||||||
|
* This method is protected by default in order to keep the public
|
||||||
|
* api reasonable. You can provide public methods for those you
|
||||||
|
* actually need in CcMusicDirs.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||||
|
* @return PropelCollection|array CcFiles[] List of CcFiles objects
|
||||||
|
*/
|
||||||
|
public function getCcFilessJoinCcSubjs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = CcFilesQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('CcSubjs', $join_behavior);
|
||||||
|
|
||||||
|
return $this->getCcFiless($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the current object and sets all attributes to their default values
|
||||||
|
*/
|
||||||
|
public function clear()
|
||||||
|
{
|
||||||
|
$this->id = null;
|
||||||
|
$this->directory = null;
|
||||||
|
$this->type = null;
|
||||||
|
$this->alreadyInSave = false;
|
||||||
|
$this->alreadyInValidation = false;
|
||||||
|
$this->clearAllReferences();
|
||||||
|
$this->resetModified();
|
||||||
|
$this->setNew(true);
|
||||||
|
$this->setDeleted(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets all collections of referencing foreign keys.
|
||||||
|
*
|
||||||
|
* This method is a user-space workaround for PHP's inability to garbage collect objects
|
||||||
|
* with circular references. This is currently necessary when using Propel in certain
|
||||||
|
* daemon or large-volumne/high-memory operations.
|
||||||
|
*
|
||||||
|
* @param boolean $deep Whether to also clear the references on all associated objects.
|
||||||
|
*/
|
||||||
|
public function clearAllReferences($deep = false)
|
||||||
|
{
|
||||||
|
if ($deep) {
|
||||||
|
if ($this->collCcFiless) {
|
||||||
|
foreach ((array) $this->collCcFiless as $o) {
|
||||||
|
$o->clearAllReferences($deep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // if ($deep)
|
||||||
|
|
||||||
|
$this->collCcFiless = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Catches calls to virtual methods
|
||||||
|
*/
|
||||||
|
public function __call($name, $params)
|
||||||
|
{
|
||||||
|
if (preg_match('/get(\w+)/', $name, $matches)) {
|
||||||
|
$virtualColumn = $matches[1];
|
||||||
|
if ($this->hasVirtualColumn($virtualColumn)) {
|
||||||
|
return $this->getVirtualColumn($virtualColumn);
|
||||||
|
}
|
||||||
|
// no lcfirst in php<5.3...
|
||||||
|
$virtualColumn[0] = strtolower($virtualColumn[0]);
|
||||||
|
if ($this->hasVirtualColumn($virtualColumn)) {
|
||||||
|
return $this->getVirtualColumn($virtualColumn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new PropelException('Call to undefined method: ' . $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // BaseCcMusicDirs
|
|
@ -0,0 +1,747 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base static class for performing query and update operations on the 'cc_music_dirs' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcMusicDirsPeer {
|
||||||
|
|
||||||
|
/** the default database name for this class */
|
||||||
|
const DATABASE_NAME = 'airtime';
|
||||||
|
|
||||||
|
/** the table name for this class */
|
||||||
|
const TABLE_NAME = 'cc_music_dirs';
|
||||||
|
|
||||||
|
/** the related Propel class for this table */
|
||||||
|
const OM_CLASS = 'CcMusicDirs';
|
||||||
|
|
||||||
|
/** A class that can be returned by this peer. */
|
||||||
|
const CLASS_DEFAULT = 'airtime.CcMusicDirs';
|
||||||
|
|
||||||
|
/** the related TableMap class for this table */
|
||||||
|
const TM_CLASS = 'CcMusicDirsTableMap';
|
||||||
|
|
||||||
|
/** 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 ID field */
|
||||||
|
const ID = 'cc_music_dirs.ID';
|
||||||
|
|
||||||
|
/** the column name for the DIRECTORY field */
|
||||||
|
const DIRECTORY = 'cc_music_dirs.DIRECTORY';
|
||||||
|
|
||||||
|
/** the column name for the TYPE field */
|
||||||
|
const TYPE = 'cc_music_dirs.TYPE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identiy map to hold any loaded instances of CcMusicDirs objects.
|
||||||
|
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||||
|
* queries.
|
||||||
|
* @var array CcMusicDirs[]
|
||||||
|
*/
|
||||||
|
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 ('Id', 'Directory', 'Type', ),
|
||||||
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'directory', 'type', ),
|
||||||
|
BasePeer::TYPE_COLNAME => array (self::ID, self::DIRECTORY, self::TYPE, ),
|
||||||
|
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'DIRECTORY', 'TYPE', ),
|
||||||
|
BasePeer::TYPE_FIELDNAME => array ('id', 'directory', '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 ('Id' => 0, 'Directory' => 1, 'Type' => 2, ),
|
||||||
|
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'directory' => 1, 'type' => 2, ),
|
||||||
|
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::DIRECTORY => 1, self::TYPE => 2, ),
|
||||||
|
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'DIRECTORY' => 1, 'TYPE' => 2, ),
|
||||||
|
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'directory' => 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. CcMusicDirsPeer::COLUMN_NAME).
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function alias($alias, $column)
|
||||||
|
{
|
||||||
|
return str_replace(CcMusicDirsPeer::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(CcMusicDirsPeer::ID);
|
||||||
|
$criteria->addSelectColumn(CcMusicDirsPeer::DIRECTORY);
|
||||||
|
$criteria->addSelectColumn(CcMusicDirsPeer::TYPE);
|
||||||
|
} else {
|
||||||
|
$criteria->addSelectColumn($alias . '.ID');
|
||||||
|
$criteria->addSelectColumn($alias . '.DIRECTORY');
|
||||||
|
$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(CcMusicDirsPeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcMusicDirsPeer::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(CcMusicDirsPeer::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 CcMusicDirs
|
||||||
|
* @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 = CcMusicDirsPeer::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 CcMusicDirsPeer::populateObjects(CcMusicDirsPeer::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(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
CcMusicDirsPeer::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 CcMusicDirs $value A CcMusicDirs object.
|
||||||
|
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
|
||||||
|
*/
|
||||||
|
public static function addInstanceToPool(CcMusicDirs $obj, $key = null)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled()) {
|
||||||
|
if ($key === null) {
|
||||||
|
$key = (string) $obj->getId();
|
||||||
|
} // 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 CcMusicDirs object or a primary key value.
|
||||||
|
*/
|
||||||
|
public static function removeInstanceFromPool($value)
|
||||||
|
{
|
||||||
|
if (Propel::isInstancePoolingEnabled() && $value !== null) {
|
||||||
|
if (is_object($value) && $value instanceof CcMusicDirs) {
|
||||||
|
$key = (string) $value->getId();
|
||||||
|
} 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 CcMusicDirs 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 CcMusicDirs 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_music_dirs
|
||||||
|
* by a foreign key with ON DELETE CASCADE
|
||||||
|
*/
|
||||||
|
public static function clearRelatedInstancePool()
|
||||||
|
{
|
||||||
|
// Invalidate objects in CcFilesPeer instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
CcFilesPeer::clearInstancePool();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
*
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, a serialize()d version of the primary key will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row PropelPDO resultset row.
|
||||||
|
* @param int $startcol The 0-based offset for reading from the resultset row.
|
||||||
|
* @return string A string version of PK or NULL if the components of primary key in result array are all null.
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
|
||||||
|
{
|
||||||
|
// If the PK cannot be derived from the row, return NULL.
|
||||||
|
if ($row[$startcol] === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (string) $row[$startcol];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the primary key from the DB resultset row
|
||||||
|
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
|
||||||
|
* a multi-column primary key, an array of the primary key columns will be returned.
|
||||||
|
*
|
||||||
|
* @param array $row PropelPDO resultset row.
|
||||||
|
* @param int $startcol The 0-based offset for reading from the resultset row.
|
||||||
|
* @return mixed The primary key of the row
|
||||||
|
*/
|
||||||
|
public static function getPrimaryKeyFromRow($row, $startcol = 0)
|
||||||
|
{
|
||||||
|
return (int) $row[$startcol];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The returned array will contain objects of the default type or
|
||||||
|
* objects that inherit from the default.
|
||||||
|
*
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function populateObjects(PDOStatement $stmt)
|
||||||
|
{
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
// set the class once to avoid overhead in the loop
|
||||||
|
$cls = CcMusicDirsPeer::getOMClass(false);
|
||||||
|
// populate the object(s)
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj = CcMusicDirsPeer::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;
|
||||||
|
CcMusicDirsPeer::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 (CcMusicDirs object, last column rank)
|
||||||
|
*/
|
||||||
|
public static function populateObject($row, $startcol = 0)
|
||||||
|
{
|
||||||
|
$key = CcMusicDirsPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||||
|
if (null !== ($obj = CcMusicDirsPeer::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 + CcMusicDirsPeer::NUM_COLUMNS;
|
||||||
|
} else {
|
||||||
|
$cls = CcMusicDirsPeer::OM_CLASS;
|
||||||
|
$obj = new $cls();
|
||||||
|
$col = $obj->hydrate($row, $startcol);
|
||||||
|
CcMusicDirsPeer::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(BaseCcMusicDirsPeer::DATABASE_NAME);
|
||||||
|
if (!$dbMap->hasTable(BaseCcMusicDirsPeer::TABLE_NAME))
|
||||||
|
{
|
||||||
|
$dbMap->addTableObject(new CcMusicDirsTableMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ? CcMusicDirsPeer::CLASS_DEFAULT : CcMusicDirsPeer::OM_CLASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method perform an INSERT on the database, given a CcMusicDirs or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CcMusicDirs 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(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
$criteria = clone $values; // rename for clarity
|
||||||
|
} else {
|
||||||
|
$criteria = $values->buildCriteria(); // build Criteria from CcMusicDirs object
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($criteria->containsKey(CcMusicDirsPeer::ID) && $criteria->keyContainsValue(CcMusicDirsPeer::ID) ) {
|
||||||
|
throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcMusicDirsPeer::ID.')');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// use transaction because $criteria could contain info
|
||||||
|
// for more than one table (I guess, conceivably)
|
||||||
|
$con->beginTransaction();
|
||||||
|
$pk = BasePeer::doInsert($criteria, $con);
|
||||||
|
$con->commit();
|
||||||
|
} catch(PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method perform an UPDATE on the database, given a CcMusicDirs or Criteria object.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CcMusicDirs 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(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectCriteria = new Criteria(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($values instanceof Criteria) {
|
||||||
|
$criteria = clone $values; // rename for clarity
|
||||||
|
|
||||||
|
$comparison = $criteria->getComparison(CcMusicDirsPeer::ID);
|
||||||
|
$value = $criteria->remove(CcMusicDirsPeer::ID);
|
||||||
|
if ($value) {
|
||||||
|
$selectCriteria->add(CcMusicDirsPeer::ID, $value, $comparison);
|
||||||
|
} else {
|
||||||
|
$selectCriteria->setPrimaryTableName(CcMusicDirsPeer::TABLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // $values is CcMusicDirs 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_music_dirs 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(CcMusicDirsPeer::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(CcMusicDirsPeer::TABLE_NAME, $con, CcMusicDirsPeer::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).
|
||||||
|
CcMusicDirsPeer::clearInstancePool();
|
||||||
|
CcMusicDirsPeer::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method perform a DELETE on the database, given a CcMusicDirs or Criteria object OR a primary key value.
|
||||||
|
*
|
||||||
|
* @param mixed $values Criteria or CcMusicDirs 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(CcMusicDirsPeer::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.
|
||||||
|
CcMusicDirsPeer::clearInstancePool();
|
||||||
|
// rename for clarity
|
||||||
|
$criteria = clone $values;
|
||||||
|
} elseif ($values instanceof CcMusicDirs) { // it's a model object
|
||||||
|
// invalidate the cache for this single object
|
||||||
|
CcMusicDirsPeer::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(CcMusicDirsPeer::ID, (array) $values, Criteria::IN);
|
||||||
|
// invalidate the cache for this object(s)
|
||||||
|
foreach ((array) $values as $singleval) {
|
||||||
|
CcMusicDirsPeer::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);
|
||||||
|
CcMusicDirsPeer::clearRelatedInstancePool();
|
||||||
|
$con->commit();
|
||||||
|
return $affectedRows;
|
||||||
|
} catch (PropelException $e) {
|
||||||
|
$con->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates all modified columns of given CcMusicDirs 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 CcMusicDirs $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(CcMusicDirs $obj, $cols = null)
|
||||||
|
{
|
||||||
|
$columns = array();
|
||||||
|
|
||||||
|
if ($cols) {
|
||||||
|
$dbMap = Propel::getDatabaseMap(CcMusicDirsPeer::DATABASE_NAME);
|
||||||
|
$tableMap = $dbMap->getTable(CcMusicDirsPeer::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(CcMusicDirsPeer::DATABASE_NAME, CcMusicDirsPeer::TABLE_NAME, $columns);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a single object by pkey.
|
||||||
|
*
|
||||||
|
* @param int $pk the primary key.
|
||||||
|
* @param PropelPDO $con the connection to use
|
||||||
|
* @return CcMusicDirs
|
||||||
|
*/
|
||||||
|
public static function retrieveByPK($pk, PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (null !== ($obj = CcMusicDirsPeer::getInstanceFromPool((string) $pk))) {
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(CcMusicDirsPeer::ID, $pk);
|
||||||
|
|
||||||
|
$v = CcMusicDirsPeer::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(CcMusicDirsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$objs = null;
|
||||||
|
if (empty($pks)) {
|
||||||
|
$objs = array();
|
||||||
|
} else {
|
||||||
|
$criteria = new Criteria(CcMusicDirsPeer::DATABASE_NAME);
|
||||||
|
$criteria->add(CcMusicDirsPeer::ID, $pks, Criteria::IN);
|
||||||
|
$objs = CcMusicDirsPeer::doSelect($criteria, $con);
|
||||||
|
}
|
||||||
|
return $objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // BaseCcMusicDirsPeer
|
||||||
|
|
||||||
|
// This is the static code needed to register the TableMap for this table with the main Propel class.
|
||||||
|
//
|
||||||
|
BaseCcMusicDirsPeer::buildTableMap();
|
||||||
|
|
|
@ -0,0 +1,285 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class that represents a query for the 'cc_music_dirs' table.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method CcMusicDirsQuery orderById($order = Criteria::ASC) Order by the id column
|
||||||
|
* @method CcMusicDirsQuery orderByDirectory($order = Criteria::ASC) Order by the directory column
|
||||||
|
* @method CcMusicDirsQuery orderByType($order = Criteria::ASC) Order by the type column
|
||||||
|
*
|
||||||
|
* @method CcMusicDirsQuery groupById() Group by the id column
|
||||||
|
* @method CcMusicDirsQuery groupByDirectory() Group by the directory column
|
||||||
|
* @method CcMusicDirsQuery groupByType() Group by the type column
|
||||||
|
*
|
||||||
|
* @method CcMusicDirsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||||
|
* @method CcMusicDirsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||||
|
* @method CcMusicDirsQuery innerJoin($relation) Adds a INNER JOIN clause to the query
|
||||||
|
*
|
||||||
|
* @method CcMusicDirsQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
|
||||||
|
* @method CcMusicDirsQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
|
||||||
|
* @method CcMusicDirsQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
|
||||||
|
*
|
||||||
|
* @method CcMusicDirs findOne(PropelPDO $con = null) Return the first CcMusicDirs matching the query
|
||||||
|
* @method CcMusicDirs findOneOrCreate(PropelPDO $con = null) Return the first CcMusicDirs matching the query, or a new CcMusicDirs object populated from the query conditions when no match is found
|
||||||
|
*
|
||||||
|
* @method CcMusicDirs findOneById(int $id) Return the first CcMusicDirs filtered by the id column
|
||||||
|
* @method CcMusicDirs findOneByDirectory(string $directory) Return the first CcMusicDirs filtered by the directory column
|
||||||
|
* @method CcMusicDirs findOneByType(string $type) Return the first CcMusicDirs filtered by the type column
|
||||||
|
*
|
||||||
|
* @method array findById(int $id) Return CcMusicDirs objects filtered by the id column
|
||||||
|
* @method array findByDirectory(string $directory) Return CcMusicDirs objects filtered by the directory column
|
||||||
|
* @method array findByType(string $type) Return CcMusicDirs objects filtered by the type column
|
||||||
|
*
|
||||||
|
* @package propel.generator.airtime.om
|
||||||
|
*/
|
||||||
|
abstract class BaseCcMusicDirsQuery extends ModelCriteria
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes internal state of BaseCcMusicDirsQuery 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 = 'CcMusicDirs', $modelAlias = null)
|
||||||
|
{
|
||||||
|
parent::__construct($dbName, $modelName, $modelAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new CcMusicDirsQuery object.
|
||||||
|
*
|
||||||
|
* @param string $modelAlias The alias of a model in the query
|
||||||
|
* @param Criteria $criteria Optional Criteria to build the query from
|
||||||
|
*
|
||||||
|
* @return CcMusicDirsQuery
|
||||||
|
*/
|
||||||
|
public static function create($modelAlias = null, $criteria = null)
|
||||||
|
{
|
||||||
|
if ($criteria instanceof CcMusicDirsQuery) {
|
||||||
|
return $criteria;
|
||||||
|
}
|
||||||
|
$query = new CcMusicDirsQuery();
|
||||||
|
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 CcMusicDirs|array|mixed the result, formatted by the current formatter
|
||||||
|
*/
|
||||||
|
public function findPk($key, $con = null)
|
||||||
|
{
|
||||||
|
if ((null !== ($obj = CcMusicDirsPeer::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 CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKey($key)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(CcMusicDirsPeer::ID, $key, Criteria::EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a list of primary keys
|
||||||
|
*
|
||||||
|
* @param array $keys The list of primary key to use for the query
|
||||||
|
*
|
||||||
|
* @return CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByPrimaryKeys($keys)
|
||||||
|
{
|
||||||
|
return $this->addUsingAlias(CcMusicDirsPeer::ID, $keys, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the id column
|
||||||
|
*
|
||||||
|
* @param int|array $id 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 CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterById($id = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (is_array($id) && null === $comparison) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcMusicDirsPeer::ID, $id, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the directory column
|
||||||
|
*
|
||||||
|
* @param string $directory 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 CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByDirectory($directory = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($directory)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $directory)) {
|
||||||
|
$directory = str_replace('*', '%', $directory);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcMusicDirsPeer::DIRECTORY, $directory, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query on the type column
|
||||||
|
*
|
||||||
|
* @param string $type 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 CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByType($type = null, $comparison = null)
|
||||||
|
{
|
||||||
|
if (null === $comparison) {
|
||||||
|
if (is_array($type)) {
|
||||||
|
$comparison = Criteria::IN;
|
||||||
|
} elseif (preg_match('/[\%\*]/', $type)) {
|
||||||
|
$type = str_replace('*', '%', $type);
|
||||||
|
$comparison = Criteria::LIKE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->addUsingAlias(CcMusicDirsPeer::TYPE, $type, $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related CcFiles object
|
||||||
|
*
|
||||||
|
* @param CcFiles $ccFiles the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCcFiles($ccFiles, $comparison = null)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CcMusicDirsPeer::ID, $ccFiles->getDbDirectory(), $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CcFiles relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CcFiles');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'CcFiles');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CcFiles relation CcFiles object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcFilesQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCcFiles($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exclude object from result
|
||||||
|
*
|
||||||
|
* @param CcMusicDirs $ccMusicDirs Object to remove from the list of results
|
||||||
|
*
|
||||||
|
* @return CcMusicDirsQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function prune($ccMusicDirs = null)
|
||||||
|
{
|
||||||
|
if ($ccMusicDirs) {
|
||||||
|
$this->addUsingAlias(CcMusicDirsPeer::ID, $ccMusicDirs->getId(), Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // BaseCcMusicDirsQuery
|
|
@ -120,6 +120,11 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
*/
|
*/
|
||||||
protected $aCcShowInstances;
|
protected $aCcShowInstances;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var CcFiles
|
||||||
|
*/
|
||||||
|
protected $aCcFiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
* by another object which falls in this transaction.
|
* by another object which falls in this transaction.
|
||||||
|
@ -640,6 +645,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
$this->modifiedColumns[] = CcSchedulePeer::FILE_ID;
|
$this->modifiedColumns[] = CcSchedulePeer::FILE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null && $this->aCcFiles->getDbId() !== $v) {
|
||||||
|
$this->aCcFiles = null;
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
} // setDbFileId()
|
} // setDbFileId()
|
||||||
|
|
||||||
|
@ -1062,6 +1071,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
public function ensureConsistency()
|
public function ensureConsistency()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
|
||||||
|
$this->aCcFiles = null;
|
||||||
|
}
|
||||||
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
|
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
|
||||||
$this->aCcShowInstances = null;
|
$this->aCcShowInstances = null;
|
||||||
}
|
}
|
||||||
|
@ -1105,6 +1117,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
if ($deep) { // also de-associate any related objects?
|
if ($deep) { // also de-associate any related objects?
|
||||||
|
|
||||||
$this->aCcShowInstances = null;
|
$this->aCcShowInstances = null;
|
||||||
|
$this->aCcFiles = null;
|
||||||
} // if (deep)
|
} // if (deep)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1229,6 +1242,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
$this->setCcShowInstances($this->aCcShowInstances);
|
$this->setCcShowInstances($this->aCcShowInstances);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null) {
|
||||||
|
if ($this->aCcFiles->isModified() || $this->aCcFiles->isNew()) {
|
||||||
|
$affectedRows += $this->aCcFiles->save($con);
|
||||||
|
}
|
||||||
|
$this->setCcFiles($this->aCcFiles);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->isNew() ) {
|
if ($this->isNew() ) {
|
||||||
$this->modifiedColumns[] = CcSchedulePeer::ID;
|
$this->modifiedColumns[] = CcSchedulePeer::ID;
|
||||||
}
|
}
|
||||||
|
@ -1329,6 +1349,12 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->aCcFiles !== null) {
|
||||||
|
if (!$this->aCcFiles->validate($columns)) {
|
||||||
|
$failureMap = array_merge($failureMap, $this->aCcFiles->getValidationFailures());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) {
|
if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) {
|
||||||
$failureMap = array_merge($failureMap, $retval);
|
$failureMap = array_merge($failureMap, $retval);
|
||||||
|
@ -1453,6 +1479,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
if (null !== $this->aCcShowInstances) {
|
if (null !== $this->aCcShowInstances) {
|
||||||
$result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
|
$result['CcShowInstances'] = $this->aCcShowInstances->toArray($keyType, $includeLazyLoadColumns, true);
|
||||||
}
|
}
|
||||||
|
if (null !== $this->aCcFiles) {
|
||||||
|
$result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -1759,6 +1788,55 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
return $this->aCcShowInstances;
|
return $this->aCcShowInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Declares an association between this object and a CcFiles object.
|
||||||
|
*
|
||||||
|
* @param CcFiles $v
|
||||||
|
* @return CcSchedule The current object (for fluent API support)
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function setCcFiles(CcFiles $v = null)
|
||||||
|
{
|
||||||
|
if ($v === null) {
|
||||||
|
$this->setDbFileId(NULL);
|
||||||
|
} else {
|
||||||
|
$this->setDbFileId($v->getDbId());
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->aCcFiles = $v;
|
||||||
|
|
||||||
|
// Add binding for other direction of this n:n relationship.
|
||||||
|
// If this object has already been added to the CcFiles object, it will not be re-added.
|
||||||
|
if ($v !== null) {
|
||||||
|
$v->addCcSchedule($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the associated CcFiles object
|
||||||
|
*
|
||||||
|
* @param PropelPDO Optional Connection object.
|
||||||
|
* @return CcFiles The associated CcFiles object.
|
||||||
|
* @throws PropelException
|
||||||
|
*/
|
||||||
|
public function getCcFiles(PropelPDO $con = null)
|
||||||
|
{
|
||||||
|
if ($this->aCcFiles === null && ($this->file_id !== null)) {
|
||||||
|
$this->aCcFiles = CcFilesQuery::create()->findPk($this->file_id, $con);
|
||||||
|
/* The following can be used additionally to
|
||||||
|
guarantee the related object contains a reference
|
||||||
|
to this object. This level of coupling may, however, be
|
||||||
|
undesirable since it could result in an only partially populated collection
|
||||||
|
in the referenced object.
|
||||||
|
$this->aCcFiles->addCcSchedules($this);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
return $this->aCcFiles;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
|
@ -1802,6 +1880,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
|
||||||
} // if ($deep)
|
} // if ($deep)
|
||||||
|
|
||||||
$this->aCcShowInstances = null;
|
$this->aCcShowInstances = null;
|
||||||
|
$this->aCcFiles = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// aggregate_column_relation behavior
|
// aggregate_column_relation behavior
|
||||||
|
|
|
@ -545,6 +545,56 @@ abstract class BaseCcSchedulePeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria, joining the related CcFiles table
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCountJoinCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
// we're going to modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$count = (int) $row[0];
|
||||||
|
} else {
|
||||||
|
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects a collection of CcSchedule objects pre-filled with their CcShowInstances objects.
|
* Selects a collection of CcSchedule objects pre-filled with their CcShowInstances objects.
|
||||||
* @param Criteria $criteria
|
* @param Criteria $criteria
|
||||||
|
@ -611,6 +661,72 @@ abstract class BaseCcSchedulePeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcSchedule objects pre-filled with their CcFiles objects.
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return array Array of CcSchedule objects.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doSelectJoinCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// Set the correct dbName if it has not been overridden
|
||||||
|
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
$startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj1->hydrate($row, 0, true); // rehydrate
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$cls = CcSchedulePeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj1 = new $cls();
|
||||||
|
$obj1->hydrate($row);
|
||||||
|
CcSchedulePeer::addInstanceToPool($obj1, $key1);
|
||||||
|
} // if $obj1 already loaded
|
||||||
|
|
||||||
|
$key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol);
|
||||||
|
if ($key2 !== null) {
|
||||||
|
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
|
||||||
|
if (!$obj2) {
|
||||||
|
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj2 = new $cls();
|
||||||
|
$obj2->hydrate($row, $startcol);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj2, $key2);
|
||||||
|
} // if obj2 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcSchedule) to $obj2 (CcFiles)
|
||||||
|
$obj2->addCcSchedule($obj1);
|
||||||
|
|
||||||
|
} // if joined row was not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows matching criteria, joining all related tables
|
* Returns the number of rows matching criteria, joining all related tables
|
||||||
*
|
*
|
||||||
|
@ -649,6 +765,8 @@ abstract class BaseCcSchedulePeer {
|
||||||
|
|
||||||
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
$stmt = BasePeer::doCount($criteria, $con);
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
@ -685,8 +803,13 @@ abstract class BaseCcSchedulePeer {
|
||||||
CcShowInstancesPeer::addSelectColumns($criteria);
|
CcShowInstancesPeer::addSelectColumns($criteria);
|
||||||
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
|
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
$stmt = BasePeer::doSelect($criteria, $con);
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
|
@ -722,6 +845,270 @@ abstract class BaseCcSchedulePeer {
|
||||||
$obj2->addCcSchedule($obj1);
|
$obj2->addCcSchedule($obj1);
|
||||||
} // if joined row not null
|
} // if joined row not null
|
||||||
|
|
||||||
|
// Add objects for joined CcFiles rows
|
||||||
|
|
||||||
|
$key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
|
||||||
|
if ($key3 !== null) {
|
||||||
|
$obj3 = CcFilesPeer::getInstanceFromPool($key3);
|
||||||
|
if (!$obj3) {
|
||||||
|
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj3 = new $cls();
|
||||||
|
$obj3->hydrate($row, $startcol3);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj3, $key3);
|
||||||
|
} // if obj3 loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcSchedule) to the collection in $obj3 (CcFiles)
|
||||||
|
$obj3->addCcSchedule($obj1);
|
||||||
|
} // if joined row not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria, joining the related CcShowInstances table
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCountJoinAllExceptCcShowInstances(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
// we're going to modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$count = (int) $row[0];
|
||||||
|
} else {
|
||||||
|
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of rows matching criteria, joining the related CcFiles table
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return int Number of matching rows.
|
||||||
|
*/
|
||||||
|
public static function doCountJoinAllExceptCcFiles(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
// we're going to modify criteria, so copy it first
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// We need to set the primary table name, since in the case that there are no WHERE columns
|
||||||
|
// it will be impossible for the BasePeer::createSelectSql() method to determine which
|
||||||
|
// tables go into the FROM clause.
|
||||||
|
$criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
|
||||||
|
|
||||||
|
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
|
$criteria->setDistinct();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$criteria->hasSelectClause()) {
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
|
||||||
|
|
||||||
|
// Set the correct dbName
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
|
||||||
|
if ($con === null) {
|
||||||
|
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
$stmt = BasePeer::doCount($criteria, $con);
|
||||||
|
|
||||||
|
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$count = (int) $row[0];
|
||||||
|
} else {
|
||||||
|
$count = 0; // no rows returned; we infer that means 0 matches.
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcSchedule objects pre-filled with all related objects except CcShowInstances.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return array Array of CcSchedule objects.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doSelectJoinAllExceptCcShowInstances(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// Set the correct dbName if it has not been overridden
|
||||||
|
// $criteria->getDbName() will return the same object if not set to another value
|
||||||
|
// so == check is okay and faster
|
||||||
|
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
$startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcFilesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
|
||||||
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj1->hydrate($row, 0, true); // rehydrate
|
||||||
|
} else {
|
||||||
|
$cls = CcSchedulePeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj1 = new $cls();
|
||||||
|
$obj1->hydrate($row);
|
||||||
|
CcSchedulePeer::addInstanceToPool($obj1, $key1);
|
||||||
|
} // if obj1 already loaded
|
||||||
|
|
||||||
|
// Add objects for joined CcFiles rows
|
||||||
|
|
||||||
|
$key2 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||||
|
if ($key2 !== null) {
|
||||||
|
$obj2 = CcFilesPeer::getInstanceFromPool($key2);
|
||||||
|
if (!$obj2) {
|
||||||
|
|
||||||
|
$cls = CcFilesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj2 = new $cls();
|
||||||
|
$obj2->hydrate($row, $startcol2);
|
||||||
|
CcFilesPeer::addInstanceToPool($obj2, $key2);
|
||||||
|
} // if $obj2 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcSchedule) to the collection in $obj2 (CcFiles)
|
||||||
|
$obj2->addCcSchedule($obj1);
|
||||||
|
|
||||||
|
} // if joined row is not null
|
||||||
|
|
||||||
|
$results[] = $obj1;
|
||||||
|
}
|
||||||
|
$stmt->closeCursor();
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects a collection of CcSchedule objects pre-filled with all related objects except CcFiles.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria
|
||||||
|
* @param PropelPDO $con
|
||||||
|
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
|
||||||
|
* @return array Array of CcSchedule objects.
|
||||||
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
|
* rethrown wrapped into a PropelException.
|
||||||
|
*/
|
||||||
|
public static function doSelectJoinAllExceptCcFiles(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$criteria = clone $criteria;
|
||||||
|
|
||||||
|
// Set the correct dbName if it has not been overridden
|
||||||
|
// $criteria->getDbName() will return the same object if not set to another value
|
||||||
|
// so == check is okay and faster
|
||||||
|
if ($criteria->getDbName() == Propel::getDefaultDB()) {
|
||||||
|
$criteria->setDbName(self::DATABASE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
CcSchedulePeer::addSelectColumns($criteria);
|
||||||
|
$startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
CcShowInstancesPeer::addSelectColumns($criteria);
|
||||||
|
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||||
|
|
||||||
|
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
|
||||||
|
|
||||||
|
|
||||||
|
$stmt = BasePeer::doSelect($criteria, $con);
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
|
||||||
|
$key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
|
||||||
|
if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
|
||||||
|
// We no longer rehydrate the object, since this can cause data loss.
|
||||||
|
// See http://www.propelorm.org/ticket/509
|
||||||
|
// $obj1->hydrate($row, 0, true); // rehydrate
|
||||||
|
} else {
|
||||||
|
$cls = CcSchedulePeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj1 = new $cls();
|
||||||
|
$obj1->hydrate($row);
|
||||||
|
CcSchedulePeer::addInstanceToPool($obj1, $key1);
|
||||||
|
} // if obj1 already loaded
|
||||||
|
|
||||||
|
// Add objects for joined CcShowInstances rows
|
||||||
|
|
||||||
|
$key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
|
||||||
|
if ($key2 !== null) {
|
||||||
|
$obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
|
||||||
|
if (!$obj2) {
|
||||||
|
|
||||||
|
$cls = CcShowInstancesPeer::getOMClass(false);
|
||||||
|
|
||||||
|
$obj2 = new $cls();
|
||||||
|
$obj2->hydrate($row, $startcol2);
|
||||||
|
CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
|
||||||
|
} // if $obj2 already loaded
|
||||||
|
|
||||||
|
// Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
|
||||||
|
$obj2->addCcSchedule($obj1);
|
||||||
|
|
||||||
|
} // if joined row is not null
|
||||||
|
|
||||||
$results[] = $obj1;
|
$results[] = $obj1;
|
||||||
}
|
}
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
* @method CcScheduleQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
|
* @method CcScheduleQuery rightJoinCcShowInstances($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcShowInstances relation
|
||||||
* @method CcScheduleQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
|
* @method CcScheduleQuery innerJoinCcShowInstances($relationAlias = '') Adds a INNER JOIN clause to the query using the CcShowInstances relation
|
||||||
*
|
*
|
||||||
|
* @method CcScheduleQuery leftJoinCcFiles($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcFiles relation
|
||||||
|
* @method CcScheduleQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
|
||||||
|
* @method CcScheduleQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
|
||||||
|
*
|
||||||
* @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query
|
* @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query
|
||||||
* @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
|
* @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
|
||||||
*
|
*
|
||||||
|
@ -641,6 +645,70 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
|
||||||
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
|
->useQuery($relationAlias ? $relationAlias : 'CcShowInstances', 'CcShowInstancesQuery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the query by a related CcFiles object
|
||||||
|
*
|
||||||
|
* @param CcFiles $ccFiles the related object to use as filter
|
||||||
|
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||||
|
*
|
||||||
|
* @return CcScheduleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function filterByCcFiles($ccFiles, $comparison = null)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->addUsingAlias(CcSchedulePeer::FILE_ID, $ccFiles->getDbId(), $comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a JOIN clause to the query using the CcFiles relation
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcScheduleQuery The current query, for fluid interface
|
||||||
|
*/
|
||||||
|
public function joinCcFiles($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$tableMap = $this->getTableMap();
|
||||||
|
$relationMap = $tableMap->getRelation('CcFiles');
|
||||||
|
|
||||||
|
// create a ModelJoin object for this join
|
||||||
|
$join = new ModelJoin();
|
||||||
|
$join->setJoinType($joinType);
|
||||||
|
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
|
||||||
|
if ($previousJoin = $this->getPreviousJoin()) {
|
||||||
|
$join->setPreviousJoin($previousJoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the ModelJoin to the current object
|
||||||
|
if($relationAlias) {
|
||||||
|
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
|
||||||
|
$this->addJoinObject($join, $relationAlias);
|
||||||
|
} else {
|
||||||
|
$this->addJoinObject($join, 'CcFiles');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the CcFiles relation CcFiles object
|
||||||
|
*
|
||||||
|
* @see useQuery()
|
||||||
|
*
|
||||||
|
* @param string $relationAlias optional alias for the relation,
|
||||||
|
* to be used as main alias in the secondary query
|
||||||
|
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
|
||||||
|
*
|
||||||
|
* @return CcFilesQuery A secondary query class using the current class as primary query
|
||||||
|
*/
|
||||||
|
public function useCcFilesQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->joinCcFiles($relationAlias, $joinType)
|
||||||
|
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exclude object from result
|
* Exclude object from result
|
||||||
*
|
*
|
||||||
|
|
|
@ -1809,6 +1809,31 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this CcShowInstances is new, it will return
|
||||||
|
* an empty collection; or if this CcShowInstances has previously
|
||||||
|
* been saved, it will retrieve related CcSchedules from storage.
|
||||||
|
*
|
||||||
|
* This method is protected by default in order to keep the public
|
||||||
|
* api reasonable. You can provide public methods for those you
|
||||||
|
* actually need in CcShowInstances.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||||
|
* @return PropelCollection|array CcSchedule[] List of CcSchedule objects
|
||||||
|
*/
|
||||||
|
public function getCcSchedulesJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = CcScheduleQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('CcFiles', $join_behavior);
|
||||||
|
|
||||||
|
return $this->getCcSchedules($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the current object and sets all attributes to their default values
|
* Clears the current object and sets all attributes to their default values
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1669,6 +1669,31 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this collection has already been initialized with
|
||||||
|
* an identical criteria, it returns the collection.
|
||||||
|
* Otherwise if this CcSubjs is new, it will return
|
||||||
|
* an empty collection; or if this CcSubjs has previously
|
||||||
|
* been saved, it will retrieve related CcFiless from storage.
|
||||||
|
*
|
||||||
|
* This method is protected by default in order to keep the public
|
||||||
|
* api reasonable. You can provide public methods for those you
|
||||||
|
* actually need in CcSubjs.
|
||||||
|
*
|
||||||
|
* @param Criteria $criteria optional Criteria object to narrow the query
|
||||||
|
* @param PropelPDO $con optional connection object
|
||||||
|
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
|
||||||
|
* @return PropelCollection|array CcFiles[] List of CcFiles objects
|
||||||
|
*/
|
||||||
|
public function getCcFilessJoinCcMusicDirs($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
|
||||||
|
{
|
||||||
|
$query = CcFilesQuery::create(null, $criteria);
|
||||||
|
$query->joinWith('CcMusicDirs', $join_behavior);
|
||||||
|
|
||||||
|
return $this->getCcFiless($query, $con);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the collCcPermss collection
|
* Clears out the collCcPermss collection
|
||||||
*
|
*
|
||||||
|
|
31
airtime_mvc/application/models/airtime/om/CcFiles.php
Normal file
31
airtime_mvc/application/models/airtime/om/CcFiles.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('Common.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_files' 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.campcaster
|
||||||
|
*/
|
||||||
|
class CcFiles extends BaseCcFiles {
|
||||||
|
|
||||||
|
public function getDbLength()
|
||||||
|
{
|
||||||
|
return $this->length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDbLength($time)
|
||||||
|
{
|
||||||
|
$this->length = $time;
|
||||||
|
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::LENGTH;
|
||||||
|
return Common::setTimeInSub($this, 'LENGTH', $time);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // CcFiles
|
48
airtime_mvc/application/models/airtime/om/CcPlaylist.php
Normal file
48
airtime_mvc/application/models/airtime/om/CcPlaylist.php
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_playlist' 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.campcaster
|
||||||
|
*/
|
||||||
|
class CcPlaylist extends BaseCcPlaylist {
|
||||||
|
|
||||||
|
|
||||||
|
public function computeLastPosition()
|
||||||
|
{
|
||||||
|
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||||
|
|
||||||
|
$sql = 'SELECT MAX('.CcPlaylistcontentsPeer::POSITION.') AS pos'
|
||||||
|
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
|
||||||
|
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
|
||||||
|
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p1', $this->getDbId());
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetchColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function computeLength()
|
||||||
|
{
|
||||||
|
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||||
|
|
||||||
|
$sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length'
|
||||||
|
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
|
||||||
|
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
|
||||||
|
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':p1', $this->getDbId());
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetchColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // CcPlaylist
|
|
@ -0,0 +1,81 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once('Common.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton subclass for representing a row from the 'cc_playlistcontents' 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.campcaster
|
||||||
|
*/
|
||||||
|
class CcPlaylistcontents extends BaseCcPlaylistcontents {
|
||||||
|
|
||||||
|
public function getDbFadein()
|
||||||
|
{
|
||||||
|
return $this->fadein;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDbFadein($time)
|
||||||
|
{
|
||||||
|
$this->fadein = $time;
|
||||||
|
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
|
||||||
|
Common::setTimeInSub($this, 'FADEIN', $time);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDbFadeout()
|
||||||
|
{
|
||||||
|
return $this->fadeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDbFadeout($time)
|
||||||
|
{
|
||||||
|
$this->fadeout = $time;
|
||||||
|
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
|
||||||
|
Common::setTimeInSub($this, 'FADEOUT', $time);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDbCuein()
|
||||||
|
{
|
||||||
|
return $this->cuein;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDbCuein($time)
|
||||||
|
{
|
||||||
|
$this->cuein = $time;
|
||||||
|
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
|
||||||
|
Common::setTimeInSub($this, 'CUEIN', $time);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDbCueout()
|
||||||
|
{
|
||||||
|
return $this->cueout;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDbCueout($time)
|
||||||
|
{
|
||||||
|
$this->cueout = $time;
|
||||||
|
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
|
||||||
|
Common::setTimeInSub($this, 'CUEOUT', $time);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDbCliplength()
|
||||||
|
{
|
||||||
|
return $this->cliplength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDbCliplength($time)
|
||||||
|
{
|
||||||
|
$this->cliplength = $time;
|
||||||
|
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
|
||||||
|
Common::setTimeInSub($this, 'CLIPLENGTH', $time);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // CcPlaylistcontents
|
19
airtime_mvc/application/models/airtime/om/Common.php
Normal file
19
airtime_mvc/application/models/airtime/om/Common.php
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Common {
|
||||||
|
|
||||||
|
public static function setTimeInSub($row, $col, $time)
|
||||||
|
{
|
||||||
|
$class = get_class($row).'Peer';
|
||||||
|
|
||||||
|
$con = Propel::getConnection($class::DATABASE_NAME);
|
||||||
|
|
||||||
|
$sql = 'UPDATE '.$class::TABLE_NAME
|
||||||
|
. ' SET '.$col.' = :f1'
|
||||||
|
. ' WHERE ' .$class::ID. ' = :p1';
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindValue(':f1', $time);
|
||||||
|
$stmt->bindValue(':p1', $row->getDbId());
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,8 +8,8 @@ require_once __DIR__.'/../Schedule.php';
|
||||||
require_once __DIR__.'/../Preference.php';
|
require_once __DIR__.'/../Preference.php';
|
||||||
require_once __DIR__.'/../RabbitMq.php';
|
require_once __DIR__.'/../RabbitMq.php';
|
||||||
require_once __DIR__.'/../../configs/conf.php';
|
require_once __DIR__.'/../../configs/conf.php';
|
||||||
require_once __DIR__.'/../../../install/include/AirtimeIni.php';
|
require_once __DIR__.'/../../../install_minimal/include/AirtimeIni.php';
|
||||||
require_once __DIR__.'/../../../install/include/AirtimeInstall.php';
|
require_once __DIR__.'/../../../install_minimal/include/AirtimeInstall.php';
|
||||||
require_once __DIR__.'/../../../library/propel/runtime/lib/Propel.php';
|
require_once __DIR__.'/../../../library/propel/runtime/lib/Propel.php';
|
||||||
|
|
||||||
Propel::init(__DIR__.'/../../configs/airtime-conf.php');
|
Propel::init(__DIR__.'/../../configs/airtime-conf.php');
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
<li>Select your playlist and drag and drop it to the "Items in this show" area.</li>
|
<li>Select your playlist and drag and drop it to the "Items in this show" area.</li>
|
||||||
</ol>
|
</ol>
|
||||||
<p><strong>Then you're good to go!</strong><br />
|
<p><strong>Then you're good to go!</strong><br />
|
||||||
For more detailed help, read the <a href="http://www.sourcefabric.org/en/products/airtime_manuals/">user manual</a></p>
|
For more detailed help, read the <a href="http://manuals.sourcefabric.org">user manual</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,19 @@
|
||||||
<form method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="application/x-www-form-urlencoded">
|
<form method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="multipart/form-data">
|
||||||
|
|
||||||
<?php echo $this->element->getSubform('preferences_general') ?>
|
<?php echo $this->element->getSubform('preferences_general') ?>
|
||||||
|
|
||||||
<h3 class="collapsible-header"><span class="arrow-icon"></span>SoundCloud Settings</h3>
|
|
||||||
|
<h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span>SoundCloud Settings</h3>
|
||||||
|
|
||||||
<div class="collapsible-content" id="soundcloud-settings" style="display: none;">
|
<div class="collapsible-content" id="soundcloud-settings" style="display: none;">
|
||||||
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
|
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3 class="collapsible-header" id="support-heading"><span class="arrow-icon"></span>Support Settings</h3>
|
||||||
|
<div class="collapsible-content" id="support-settings" style="display: none;">
|
||||||
|
<?php echo $this->element->getSubform('preferences_support') ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="button-bar bottom" id="submit-element">
|
<div class="button-bar bottom" id="submit-element">
|
||||||
<?php echo $this->element->getElement('submit') ?>
|
<?php echo $this->element->getElement('submit') ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
<dl class="zend_form">
|
<dl class="zend_form">
|
||||||
|
|
||||||
<dt id="stationName-label" class="block-display">
|
<dt id="stationName-label" class="block-display">
|
||||||
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?></label>
|
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>
|
||||||
|
<span class="info-text-small">(Required)</span> :
|
||||||
|
</label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="stationName-element" class="block-display">
|
<dd id="stationName-element" class="block-display">
|
||||||
<?php echo $this->element->getElement('stationName') ?>
|
<?php echo $this->element->getElement('stationName') ?>
|
||||||
|
@ -73,6 +75,5 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
<fieldset class="padded">
|
||||||
|
<dl class="zend_form">
|
||||||
|
<dd id="SupportFeedback-element" style="width:90%;">
|
||||||
|
<div class="info-text">Help Airtime improve by letting us know you are using it. This info
|
||||||
|
will be collected regularly in order to improve your user experience.</div>
|
||||||
|
<label class="optional" for="SupportFeedback">
|
||||||
|
<?php echo $this->element->getElement('SupportFeedback') ?>
|
||||||
|
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
|
||||||
|
</label>
|
||||||
|
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dd id="publicize-element" style="width:90%;">
|
||||||
|
<div class="info-text">Click the box below to advertise your station on
|
||||||
|
<a id="link_to_whos_using" href="http://sourcefabric.org/en/products/airtime_whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
|
||||||
|
In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.</div>
|
||||||
|
<label class="optional" for="Publicise">
|
||||||
|
<?php echo $this->element->getElement('Publicise') ?>
|
||||||
|
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
|
||||||
|
</label>
|
||||||
|
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to promote your station, "Send support feedback" must be enabled</p></div>
|
||||||
|
<dl id="public-info" style="display:none;">
|
||||||
|
<dt id="Phone-label" class="block-display">
|
||||||
|
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
|
||||||
|
<span class="info-text-small">(for verification purposes only, will not be published)</span>
|
||||||
|
</dt>
|
||||||
|
<dd id="Phone-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('Phone') ?>
|
||||||
|
<?php if($this->element->getElement('Phone')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Phone')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Email-label" class="block-display">
|
||||||
|
<label class="optional" for="Email"><?php echo $this->element->getElement('Email')->getLabel() ?></label>
|
||||||
|
<span class="info-text-small">(for verification purposes only, will not be published)</span>
|
||||||
|
</dt>
|
||||||
|
<dd id="Email-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('Email') ?>
|
||||||
|
<?php if($this->element->getElement('Email')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Email')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="StationWebSite-label" class="block-display">
|
||||||
|
<label class="optional" for="StationWebSite"><?php echo $this->element->getElement('StationWebSite')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="StationWebSite-element" class="block-display clearfix">
|
||||||
|
<?php echo $this->element->getElement('StationWebSite') ?>
|
||||||
|
<?php if($this->element->getElement('StationWebSite')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('StationWebSite')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Country-label" class="block-display">
|
||||||
|
<label class="optional" for="Country"><?php echo $this->element->getElement('Country')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="Country-element" class="block-display clearfix">
|
||||||
|
<?php echo $this->element->getElement('Country') ?>
|
||||||
|
<?php if($this->element->getElement('Country')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Country')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="City-label" class="block-display">
|
||||||
|
<label class="optional" for="City"><?php echo $this->element->getElement('City')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="City-element" class="block-display clearfix">
|
||||||
|
<?php echo $this->element->getElement('City') ?>
|
||||||
|
<?php if($this->element->getElement('City')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('City')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Description-label" class="block-display">
|
||||||
|
<label class="optional" for="Description"><?php echo $this->element->getElement('Description')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="Description-element" class="block-display clearfix">
|
||||||
|
<?php echo $this->element->getElement('Description') ?>
|
||||||
|
<?php if($this->element->getElement('Description')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Description')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Logo-label" class="block-display">
|
||||||
|
<label class="optional" for="Description"><?php echo $this->element->getElement('Logo')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="Logo-element" class="block-display clearfix">
|
||||||
|
<?php if($this->element->getView()->logoImg){?>
|
||||||
|
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
|
<?php echo $this->element->getElement('Logo') ?>
|
||||||
|
<div class="info-text"><p>Min. size: 200x200 Max. size: 600x600</p></div>
|
||||||
|
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<div id="show_what_sending" style="display: block;">
|
||||||
|
<fieldset class="display_field toggle closed">
|
||||||
|
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Show me what I am sending </legend>
|
||||||
|
<dl>
|
||||||
|
<?php echo $this->element->getElement('SendInfo') ?>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<br>
|
||||||
|
<label class="optional" for="Privacy">
|
||||||
|
<?php echo $this->element->getElement('Privacy') ?>
|
||||||
|
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
|
||||||
|
</label>
|
||||||
|
<?php if($this->element->getElement('Privacy')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Privacy')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
|
@ -0,0 +1,52 @@
|
||||||
|
<fieldset class="padded" id="watched-folder-section">
|
||||||
|
<dl class="zend_form">
|
||||||
|
|
||||||
|
<dt id="storageFolder-label" class="block-display">
|
||||||
|
<label class="required" for="storageFolder"><?php echo $this->element->getElement('storageFolder')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="storageFolder-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('storageFolder') ?>
|
||||||
|
<input id="storageFolder-selection" type="button" value="Choose folder"></input>
|
||||||
|
<input id="storageFolder-ok" type="button" value="Set"></input>
|
||||||
|
<?php if($this->element->getElement('storageFolder')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('storageFolder')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dd class="block-display selected-item"><strong>Current Storage Folder:</strong><?php $stor = MusicDir::getStorDir(); echo $stor->getDirectory(); ?></dd>
|
||||||
|
|
||||||
|
<dt id="watchedFolder-label" class="block-display">
|
||||||
|
<label class="required" for="watchedFolder"><?php echo $this->element->getElement('watchedFolder')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="watchedFolder-element" class="block-display">
|
||||||
|
<?php echo $this->element->getElement('watchedFolder') ?>
|
||||||
|
<input id="watchedFolder-selection" type="button" value="Choose folder"></input>
|
||||||
|
<input id="watchedFolder-ok" type="button" value="Add"></input>
|
||||||
|
<?php if($this->element->getElement('watchedFolder')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('watchedFolder')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<?php $watched_dirs = MusicDir::getWatchedDirs(); ?>
|
||||||
|
|
||||||
|
<?php if (count($watched_dirs) > 0): ?>
|
||||||
|
<?php foreach($watched_dirs as $watched_dir): ?>
|
||||||
|
<dd class="block-display selected-item">
|
||||||
|
<span><?php echo $watched_dir->getDirectory(); ?></span><span class="ui-icon ui-icon-close"></span>
|
||||||
|
</dd>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<dd class="block-display selected-item">
|
||||||
|
<span>You are not watching any media folders.</span>
|
||||||
|
</dd>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
175
airtime_mvc/application/views/scripts/form/register-dialog.phtml
Normal file
175
airtime_mvc/application/views/scripts/form/register-dialog.phtml
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
<div id="register_popup" class="dialogPopup register-dialog" title="Register Airtime" style="display: none;">
|
||||||
|
<form id="register-form" method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="multipart/form-data">
|
||||||
|
<fieldset>
|
||||||
|
<dl class="zend_form">
|
||||||
|
<dt class="block-display info-text">
|
||||||
|
Help Airtime improve by letting us know you are using it. This info
|
||||||
|
will be collected regularly in order to improve your user experience.
|
||||||
|
</dt>
|
||||||
|
<dd id="SupportFeedback-element" class="block-display">
|
||||||
|
<label class="optional" for="SupportFeedback">
|
||||||
|
<?php echo $this->element->getElement('SupportFeedback') ?>
|
||||||
|
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
|
||||||
|
</label>
|
||||||
|
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt class="block-display info-text">
|
||||||
|
Click the box below to advertise your station on
|
||||||
|
<a id="link_to_whos_using" href="http://sourcefabric.org/en/products/airtime_whosusing" onclick="window.open(this.href); return false">Sourcefabric.org</a>.
|
||||||
|
In order to promote your station, "Send support feedback" must be enabled. This data will be collected in addition to the support feedback.
|
||||||
|
</dt>
|
||||||
|
<dd id="publicize-element" class="block-display">
|
||||||
|
<label class="optional" for="Publicise">
|
||||||
|
<?php echo $this->element->getElement('Publicise') ?>
|
||||||
|
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
|
||||||
|
</label>
|
||||||
|
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
<dl id="public-info" style="display:none;">
|
||||||
|
<dt id="stnName-label">
|
||||||
|
<label class="optional" for="stnName"><?php echo $this->element->getElement('stnName')->getLabel() ?>
|
||||||
|
<span class="info-text-small">(Required)</span> :
|
||||||
|
</label>
|
||||||
|
</dt>
|
||||||
|
<dd id="stnName-element">
|
||||||
|
<?php echo $this->element->getElement('stnName') ?>
|
||||||
|
<?php if($this->element->getElement('stnName')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('stnName')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Phone-label">
|
||||||
|
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="Phone-element">
|
||||||
|
<?php echo $this->element->getElement('Phone') ?>
|
||||||
|
<span class="info-text-small">(for verification purposes only, will not be published)</span>
|
||||||
|
<?php if($this->element->getElement('Phone')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Phone')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Email-label">
|
||||||
|
<label class="optional" for="Email"><?php echo $this->element->getElement('Email')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="Email-element">
|
||||||
|
<?php echo $this->element->getElement('Email') ?>
|
||||||
|
<span class="info-text-small">(for verification purposes only, will not be published)</span>
|
||||||
|
<?php if($this->element->getElement('Email')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Email')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="StationWebSite-label">
|
||||||
|
<label class="optional" for="StationWebSite"><?php echo $this->element->getElement('StationWebSite')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="StationWebSite-element">
|
||||||
|
<?php echo $this->element->getElement('StationWebSite') ?>
|
||||||
|
<?php if($this->element->getElement('StationWebSite')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('StationWebSite')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Country-label">
|
||||||
|
<label class="optional" for="Country"><?php echo $this->element->getElement('Country')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="Country-element">
|
||||||
|
<?php echo $this->element->getElement('Country') ?>
|
||||||
|
<?php if($this->element->getElement('Country')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Country')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="City-label">
|
||||||
|
<label class="optional" for="City"><?php echo $this->element->getElement('City')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="City-element">
|
||||||
|
<?php echo $this->element->getElement('City') ?>
|
||||||
|
<?php if($this->element->getElement('City')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('City')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Description-label">
|
||||||
|
<label class="optional" for="Description"><?php echo $this->element->getElement('Description')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
<dd id="Description-element">
|
||||||
|
<?php echo $this->element->getElement('Description') ?>
|
||||||
|
<?php if($this->element->getElement('Description')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Description')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
<dt id="Logo-label" class="block-display">
|
||||||
|
<label class="optional" for="Description"><?php echo $this->element->getElement('Logo')->getLabel() ?></label>
|
||||||
|
</dt>
|
||||||
|
|
||||||
|
<dd id="Logo-element">
|
||||||
|
<?php if($this->element->getView()->logoImg){?>
|
||||||
|
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
|
||||||
|
<?php }?>
|
||||||
|
|
||||||
|
<?php echo $this->element->getElement('Logo') ?>
|
||||||
|
<p class="info-text">Min. size: 200x200 Max. size: 600x600</p>
|
||||||
|
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
|
||||||
|
<ul class='errors'>
|
||||||
|
<?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<div id="show_what_sending" style="display: block;">
|
||||||
|
<fieldset class="display_field toggle closed">
|
||||||
|
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Show me what I am sending </legend>
|
||||||
|
<dl>
|
||||||
|
<?php echo $this->element->getElement('SendInfo') ?>
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<br>
|
||||||
|
<label class="optional" for="Privacy">
|
||||||
|
<?php echo $this->element->getElement('Privacy') ?>
|
||||||
|
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -1,32 +1,21 @@
|
||||||
<?php if($this->type == "au") : ?>
|
<?php if($this->type == "au") : ?>
|
||||||
<div><span>Title:</span><span><?php echo ($this->md["dc:title"]);?></span></div>
|
<div><span>Title:</span><span><?php echo ($this->md["MDATA_KEY_TITLE"]);?></span></div>
|
||||||
<div><span>Artist:</span><span><?php echo ($this->md["dc:creator"]);?></span></div>
|
<div><span>Artist:</span><span><?php echo ($this->md["MDATA_KEY_CREATOR"]);?></span></div>
|
||||||
<div><span>Album:</span><span><?php echo ($this->md["dc:source"]);?></span></div>
|
<div><span>Album:</span><span><?php echo ($this->md["MDATA_KEY_SOURCE"]);?></span></div>
|
||||||
<div><span>Track:</span><span><?php echo ($this->md["ls:track_num"]);?></span></div>
|
<div><span>Track:</span><span><?php echo ($this->md["MDATA_KEY_TRACKNUMBER"]);?></span></div>
|
||||||
<div><span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span></div>
|
<div><span>Length:</span><span><?php echo ($this->md["MDATA_KEY_DURATION"]);?></span></div>
|
||||||
<div><span>Genre:</span><span><?php echo ($this->md["dc:type"]);?></span></div>
|
<div><span>Sample Rate:</span><span><?php echo ($this->md["MDATA_KEY_SAMPLERATE"]);?></span></div>
|
||||||
<div><span>Sample Rate:</span><span><?php echo ($this->md["ls:samplerate"]);?></span></div>
|
<div><span>Bit Rate:</span><span><?php echo ($this->md["MDATA_KEY_BITRATE"]);?></span></div>
|
||||||
<div><span>Bit Rate:</span><span><?php echo ($this->md["ls:bitrate"]);?></span></div>
|
<div><span>Mood:</span><span><?php echo ($this->md["MDATA_KEY_MOOD"]);?></span></div>
|
||||||
<div><span>Channels:</span><span><?php echo ($this->md["ls:channels"]);?></span></div>
|
<div><span>Genre:</span><span><?php echo ($this->md["MDATA_KEY_GENRE"]);?></span></div>
|
||||||
|
<div><span>Year:</span><span><?php echo ($this->md["MDATA_KEY_YEAR"]);?></span></div>
|
||||||
|
<div><span>Label:</span><span><?php echo ($this->md["MDATA_KEY_LABEL"]);?></span></div>
|
||||||
|
<div><span>BPM:</span><span><?php echo ($this->md["MDATA_KEY_BPM"]);?></span></div>
|
||||||
|
<div><span>Conductor:</span><span><?php echo ($this->md["MDATA_KEY_CONDUCTOR"]);?></span></div>
|
||||||
|
<div><span>Copyright:</span><span><?php echo ($this->md["MDATA_KEY_COPYRIGHT"]);?></span></div>
|
||||||
|
<div><span>Isrc Number:</span><span><?php echo ($this->md["MDATA_KEY_ISRC"]);?></span></div>
|
||||||
|
<div><span>Website:</span><span><?php echo ($this->md["MDATA_KEY_URL"]);?></span></div>
|
||||||
|
|
||||||
<div><span>Year:</span><span><?php echo ($this->md["ls:year"]);?></span></div>
|
|
||||||
<div><span>Label:</span><span><?php echo ($this->md["dc:publisher"]);?></span></div>
|
|
||||||
<div><span>BPM:</span><span><?php echo ($this->md["ls:bpm"]);?></span></div>
|
|
||||||
<div><span>Channels:</span><span><?php echo ($this->md["ls:channels"]);?></span></div>
|
|
||||||
<div><span>Orchestra:</span><span><?php echo ($this->md["ls:orchestra"]);?></span></div>
|
|
||||||
<div><span>Conductor:</span><span><?php echo ($this->md["ls:conductor"]);?></span></div>
|
|
||||||
<div><span>Copyright:</span><span><?php echo ($this->md["dc:rights"]);?></span></div>
|
|
||||||
<div><span>Catalog Number:</span><span><?php echo ($this->md["ls:catalognumber"]);?></span></div>
|
|
||||||
<div><span>Isrc Number:</span><span><?php echo ($this->md["ls:isrcnumber"]);?></span></div>
|
|
||||||
|
|
||||||
<div><span>Report Datetime:</span><span><?php echo ($this->md["dcterms:temporal"]);?></span></div>
|
|
||||||
<div><span>Report Location:</span><span><?php echo ($this->md["dcterms:spatial"]);?></span></div>
|
|
||||||
<div><span>Report Organization:</span><span><?php echo ($this->md["dcterms:entity"]);?></span></div>
|
|
||||||
<div><span>Subject:</span><span><?php echo ($this->md["dc:subject"]);?></span></div>
|
|
||||||
<div><span>Contributor:</span><span><?php echo ($this->md["dc:contributor"]);?></span></div>
|
|
||||||
|
|
||||||
<div><span>Language:</span><span><?php echo ($this->md["dc:language"]);?></span></div>
|
|
||||||
<div><span>Comments:</span><span><?php echo ($this->md["dc:description"]);?></span></div>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if($this->type == "pl") : ?>
|
<?php if($this->type == "pl") : ?>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<!--<li><a href="#advancedSearch">Advanced Search</a></li>-->
|
<!--<li><a href="#advancedSearch">Advanced Search</a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
<div id="simpleSearch">
|
<div id="simpleSearch">
|
||||||
|
<div id="import_status" style="visibility:hidden">File import in progress...</div>
|
||||||
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
|
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -2,3 +2,4 @@
|
||||||
<span class="toggle-button-active end-button" id="now_view">Now View</span><span class="toggle-button" id="day_view">Day View</span>
|
<span class="toggle-button-active end-button" id="now_view">Now View</span><span class="toggle-button" id="day_view">Day View</span>
|
||||||
</div>
|
</div>
|
||||||
<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="nowplayingtable"></table>
|
<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="nowplayingtable"></table>
|
||||||
|
<?php echo $this->dialog?>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<h3 class="plain">Playlist Metadata</h3>
|
<h3 class="plain">Playlist Metadata</h3>
|
||||||
<form method="post" action="" enctype="application/x-www-form-urlencoded">
|
<form method="post" action="" enctype="application/x-www-form-urlencoded">
|
||||||
<?php echo $this->fieldset; ?>
|
<fieldset>
|
||||||
|
<?php echo $this->fieldset; ?>
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
<?php if (count($this->pl->getContents())) : ?>
|
<?php
|
||||||
|
$items = $this->pl->getContents();
|
||||||
|
if (count($items)) : ?>
|
||||||
|
|
||||||
<?php $i = 0; ?>
|
<?php $i = 0; ?>
|
||||||
<?php foreach($this->pl->getContents() as $item) : ?>
|
<?php foreach($items as $item) : ?>
|
||||||
<li class="ui-state-default" id="spl_<?php echo $i ?>">
|
<li class="ui-state-default" id="spl_<?php echo $i ?>">
|
||||||
<div class="list-item-container">
|
<div class="list-item-container">
|
||||||
<a href="javascript:void(0);" class="big_play"
|
<a href="javascript:void(0);" class="big_play"
|
||||||
onclick="audioPreview('<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]["name"], PATHINFO_EXTENSION);?>',
|
onclick="audioPreview('<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]["filepath"], PATHINFO_EXTENSION);?>',
|
||||||
'spl_<?php echo $i ?>')"><span class="ui-icon ui-icon-play"></span></a>
|
'spl_<?php echo $i ?>')"><span class="ui-icon ui-icon-play"></span></a>
|
||||||
|
|
||||||
<div class="text-row top">
|
<div class="text-row top">
|
||||||
|
@ -15,8 +17,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="text-row">
|
<div class="text-row">
|
||||||
<span class="spl_artist"><?php echo $item["CcFiles"]['artist_name'] ?></span>
|
<span class="spl_artist"><?php echo $item["CcFiles"]['artist_name'] ?></span>
|
||||||
|
<span class="spl_offset"><?php echo $item["offset"]?></span>
|
||||||
</div>
|
</div>
|
||||||
<?php if($i < count($this->pl->getContents()) -1): ?>
|
<?php if($i < count($items) -1): ?>
|
||||||
<div id="fade_<?php echo $i ?>" class="spl_fade_control ui-state-default"></div>
|
<div id="fade_<?php echo $i ?>" class="spl_fade_control ui-state-default"></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<span class="ui-icon ui-icon-closethick"></span>
|
<span class="ui-icon ui-icon-closethick"></span>
|
||||||
|
@ -24,7 +27,7 @@
|
||||||
|
|
||||||
<div id="cues_<?php echo $i ?>" class="cue-edit clearfix" style="display: none"></div>
|
<div id="cues_<?php echo $i ?>" class="cue-edit clearfix" style="display: none"></div>
|
||||||
|
|
||||||
<?php if($i < count($this->pl->getContents()) -1): ?>
|
<?php if($i < count($items) -1): ?>
|
||||||
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none"></div>
|
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none"></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<div id="watched-folder-section" class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong manage-folders">
|
||||||
|
<h2>Manage Media Folders</h2>
|
||||||
|
<?php echo $this->form; ?>
|
||||||
|
</div>
|
|
@ -1,4 +1,4 @@
|
||||||
<?php if($this->isAdmin) : ?>
|
<?php if($this->isAdmin || $this->isProgramManager) : ?>
|
||||||
<form id="add-show-form" method="post" action="" style="display:none;">
|
<form id="add-show-form" method="post" action="" style="display:none;">
|
||||||
<?php echo $this->render('schedule/add-show-form.phtml') ?>
|
<?php echo $this->render('schedule/add-show-form.phtml') ?>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<th>Username</th>
|
<th>Username</th>
|
||||||
<th>First Name</th>
|
<th>First Name</th>
|
||||||
<th>Last Name</th>
|
<th>Last Name</th>
|
||||||
<th>Role</th>
|
<th>User Type</th>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -15,7 +15,6 @@ vhost = /
|
||||||
api_key = AAA
|
api_key = AAA
|
||||||
web_server_user = www-data
|
web_server_user = www-data
|
||||||
airtime_dir = x
|
airtime_dir = x
|
||||||
base_files_dir = x
|
|
||||||
base_url = localhost
|
base_url = localhost
|
||||||
base_port = 80
|
base_port = 80
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Note: project.home is automatically generated by the propel-install script.
|
#Note: project.home is automatically generated by the propel-install script.
|
||||||
#Any manual changes to this value will be overwritten.
|
#Any manual changes to this value will be overwritten.
|
||||||
project.home = /home/martin/workspace/airtime
|
project.home = /home/james/src/airtime/airtime_mvc
|
||||||
project.build = ${project.home}/build
|
project.build = ${project.home}/build
|
||||||
|
|
||||||
#Database driver
|
#Database driver
|
||||||
|
|
|
@ -24,12 +24,21 @@
|
||||||
<index-column name="token"/>
|
<index-column name="token"/>
|
||||||
</index>
|
</index>
|
||||||
</table>
|
</table>
|
||||||
|
<table name="cc_music_dirs" phpName="CcMusicDirs">
|
||||||
|
<column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
||||||
|
<column name="directory" phpName="Directory" type="LONGVARCHAR" required="false"/>
|
||||||
|
<column name="type" phpName="Type" type="VARCHAR" size="255" required="false"/>
|
||||||
|
<unique name="cc_music_dir_unique">
|
||||||
|
<unique-column name="directory"/>
|
||||||
|
</unique>
|
||||||
|
</table>
|
||||||
<table name="cc_files" phpName="CcFiles">
|
<table name="cc_files" phpName="CcFiles">
|
||||||
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
|
||||||
<column name="gunid" phpName="DbGunid" type="char" size="32" required="true"/>
|
<column name="gunid" phpName="DbGunid" type="char" size="32" required="true"/>
|
||||||
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue=""/>
|
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true" defaultValue=""/>
|
||||||
<column name="mime" phpName="DbMime" type="VARCHAR" size="255" required="true" defaultValue=""/>
|
<column name="mime" phpName="DbMime" type="VARCHAR" size="255" required="true" defaultValue=""/>
|
||||||
<column name="ftype" phpName="DbFtype" type="VARCHAR" size="128" required="true" defaultValue=""/>
|
<column name="ftype" phpName="DbFtype" type="VARCHAR" size="128" required="true" defaultValue=""/>
|
||||||
|
<column name="directory" phpName="DbDirectory" type="INTEGER" required="false"/>
|
||||||
<column name="filepath" phpName="DbFilepath" type="LONGVARCHAR" required="false" defaultValue=""/>
|
<column name="filepath" phpName="DbFilepath" type="LONGVARCHAR" required="false" defaultValue=""/>
|
||||||
<column name="state" phpName="DbState" type="VARCHAR" size="128" required="true" defaultValue="empty"/>
|
<column name="state" phpName="DbState" type="VARCHAR" size="128" required="true" defaultValue="empty"/>
|
||||||
<column name="currentlyaccessing" phpName="DbCurrentlyaccessing" type="INTEGER" required="true" defaultValue="0"/>
|
<column name="currentlyaccessing" phpName="DbCurrentlyaccessing" type="INTEGER" required="true" defaultValue="0"/>
|
||||||
|
@ -82,6 +91,9 @@
|
||||||
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
|
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
|
||||||
<reference local="editedby" foreign="id"/>
|
<reference local="editedby" foreign="id"/>
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="cc_music_dirs" name="cc_music_dirs_folder_fkey" onDelete="CASCADE">
|
||||||
|
<reference local="directory" foreign="id"/>
|
||||||
|
</foreign-key>
|
||||||
<unique name="cc_files_gunid_idx">
|
<unique name="cc_files_gunid_idx">
|
||||||
<unique-column name="gunid"/>
|
<unique-column name="gunid"/>
|
||||||
</unique>
|
</unique>
|
||||||
|
@ -251,6 +263,9 @@
|
||||||
<foreign-key foreignTable="cc_show_instances" name="cc_show_inst_fkey" onDelete="CASCADE">
|
<foreign-key foreignTable="cc_show_instances" name="cc_show_inst_fkey" onDelete="CASCADE">
|
||||||
<reference local="instance_id" foreign="id"/>
|
<reference local="instance_id" foreign="id"/>
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
|
<foreign-key foreignTable="cc_files" name="cc_show_file_fkey" onDelete="CASCADE">
|
||||||
|
<reference local="file_id" foreign="id"/>
|
||||||
|
</foreign-key>
|
||||||
</table>
|
</table>
|
||||||
<table name="cc_sess" phpName="CcSess">
|
<table name="cc_sess" phpName="CcSess">
|
||||||
<column name="sessid" phpName="Sessid" type="CHAR" size="32" primaryKey="true" required="true"/>
|
<column name="sessid" phpName="Sessid" type="CHAR" size="32" primaryKey="true" required="true"/>
|
||||||
|
@ -296,4 +311,8 @@
|
||||||
<unique-column name="login"/>
|
<unique-column name="login"/>
|
||||||
</unique>
|
</unique>
|
||||||
</table>
|
</table>
|
||||||
|
<table name="cc_country" phpName="CcCountry">
|
||||||
|
<column name="isocode" phpName="DbIsoCode" primaryKey="true" type="CHAR" size="3" required="true"/>
|
||||||
|
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true"/>
|
||||||
|
</table>
|
||||||
</database>
|
</database>
|
||||||
|
|
|
@ -1 +1,240 @@
|
||||||
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
|
INSERT INTO cc_subjs ("login", "type", "pass") VALUES ('admin', 'A', md5('admin'));
|
||||||
|
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ALB', 'Albania ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('DZA', 'Algeria ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ASM', 'American Samoa ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('AND', 'Andorra ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('AGO', 'Angola ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('AIA', 'Anguilla ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ATG', 'Antigua and Barbuda ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ARG', 'Argentina ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ARM', 'Armenia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ABW', 'Aruba ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('AUS', 'Australia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('AUT', 'Austria ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('AZE', 'Azerbaijan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BHS', 'Bahamas ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BHR', 'Bahrain ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BGD', 'Bangladesh ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BRB', 'Barbados ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BLR', 'Belarus ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BEL', 'Belgium ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BLZ', 'Belize ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BEN', 'Benin ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BMU', 'Bermuda ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BTN', 'Bhutan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BOL', 'Bolivia (Plurinational State of) ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BES', 'Bonaire, Saint Eustatius and Saba');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BIH', 'Bosnia and Herzegovina ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BWA', 'Botswana ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BRA', 'Brazil ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('VGB', 'British Virgin Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BRN', 'Brunei Darussalam ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BGR', 'Bulgaria ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BFA', 'Burkina Faso ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BDI', 'Burundi ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KHM', 'Cambodia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CMR', 'Cameroon ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CAN', 'Canada ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CPV', 'Cape Verde ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CYM', 'Cayman Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CAF', 'Central African Republic ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TCD', 'Chad ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CHL', 'Chile ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CHN', 'China ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('HKG', 'China, Hong Kong Special Administrative Region');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MAC', 'China, Macao Special Administrative Region');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('COL', 'Colombia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('COM', 'Comoros ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('COG', 'Congo ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('COK', 'Cook Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CRI', 'Costa Rica ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CIV', 'Côte d''Ivoire ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('HRV', 'Croatia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CUB', 'Cuba ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CUW', 'Curaçao');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CYP', 'Cyprus ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CZE', 'Czech Republic ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PRK', 'Democratic People''s Republic of Korea ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('COD', 'Democratic Republic of the Congo ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('DNK', 'Denmark ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('DJI', 'Djibouti ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('DMA', 'Dominica ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('DOM', 'Dominican Republic ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ECU', 'Ecuador ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('EGY', 'Egypt ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SLV', 'El Salvador ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GNQ', 'Equatorial Guinea ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ERI', 'Eritrea ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('EST', 'Estonia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ETH', 'Ethiopia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('FRO', 'Faeroe Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('FLK', 'Falkland Islands (Malvinas) ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('FJI', 'Fiji ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('FIN', 'Finland ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('FRA', 'France ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GUF', 'French Guiana ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PYF', 'French Polynesia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GAB', 'Gabon ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GMB', 'Gambia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GEO', 'Georgia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('DEU', 'Germany ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GHA', 'Ghana ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GIB', 'Gibraltar ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GRC', 'Greece ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GRL', 'Greenland ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GRD', 'Grenada ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GLP', 'Guadeloupe ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GUM', 'Guam ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GTM', 'Guatemala ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GGY', 'Guernsey');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GIN', 'Guinea ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GNB', 'Guinea-Bissau ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GUY', 'Guyana ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('HTI', 'Haiti ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('VAT', 'Holy See ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('HND', 'Honduras ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('HUN', 'Hungary ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ISL', 'Iceland ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('IND', 'India ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('IDN', 'Indonesia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('IRN', 'Iran (Islamic Republic of)');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('IRQ', 'Iraq ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('IRL', 'Ireland ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('IMN', 'Isle of Man ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ISR', 'Israel ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ITA', 'Italy ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('JAM', 'Jamaica ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('JPN', 'Japan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('JEY', 'Jersey');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('JOR', 'Jordan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KAZ', 'Kazakhstan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KEN', 'Kenya ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KIR', 'Kiribati ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KWT', 'Kuwait ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KGZ', 'Kyrgyzstan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LAO', 'Lao People''s Democratic Republic ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LVA', 'Latvia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LBN', 'Lebanon ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LSO', 'Lesotho ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LBR', 'Liberia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LBY', 'Libyan Arab Jamahiriya ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LIE', 'Liechtenstein ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LTU', 'Lithuania ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LUX', 'Luxembourg ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MDG', 'Madagascar ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MWI', 'Malawi ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MYS', 'Malaysia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MDV', 'Maldives ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MLI', 'Mali ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MLT', 'Malta ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MHL', 'Marshall Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MTQ', 'Martinique ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MRT', 'Mauritania ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MUS', 'Mauritius ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MYT', 'Mayotte');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MEX', 'Mexico ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('FSM', 'Micronesia (Federated States of)');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MCO', 'Monaco ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MNG', 'Mongolia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MNE', 'Montenegro');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MSR', 'Montserrat ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MAR', 'Morocco ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MOZ', 'Mozambique ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MMR', 'Myanmar ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NAM', 'Namibia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NRU', 'Nauru ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NPL', 'Nepal ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NLD', 'Netherlands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NCL', 'New Caledonia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NZL', 'New Zealand ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NIC', 'Nicaragua ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NER', 'Niger ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NGA', 'Nigeria ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NIU', 'Niue ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NFK', 'Norfolk Island ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MNP', 'Northern Mariana Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('NOR', 'Norway ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PSE', 'Occupied Palestinian Territory ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('OMN', 'Oman ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PAK', 'Pakistan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PLW', 'Palau ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PAN', 'Panama ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PNG', 'Papua New Guinea ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PRY', 'Paraguay ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PER', 'Peru ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PHL', 'Philippines ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PCN', 'Pitcairn ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('POL', 'Poland ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PRT', 'Portugal ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('PRI', 'Puerto Rico ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('QAT', 'Qatar ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KOR', 'Republic of Korea ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MDA', 'Republic of Moldova');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('REU', 'Réunion ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ROU', 'Romania ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('RUS', 'Russian Federation ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('RWA', 'Rwanda ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('BLM', 'Saint-Barthélemy');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SHN', 'Saint Helena ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('KNA', 'Saint Kitts and Nevis ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LCA', 'Saint Lucia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MAF', 'Saint-Martin (French part)');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SPM', 'Saint Pierre and Miquelon ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('VCT', 'Saint Vincent and the Grenadines ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('WSM', 'Samoa ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SMR', 'San Marino ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('STP', 'Sao Tome and Principe ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SAU', 'Saudi Arabia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SEN', 'Senegal ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SRB', 'Serbia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SYC', 'Seychelles ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SLE', 'Sierra Leone ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SGP', 'Singapore ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SXM', 'Sint Maarten (Dutch part)');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SVK', 'Slovakia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SVN', 'Slovenia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SLB', 'Solomon Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SOM', 'Somalia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ZAF', 'South Africa ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ESP', 'Spain ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('LKA', 'Sri Lanka ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SDN', 'Sudan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SUR', 'Suriname ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SJM', 'Svalbard and Jan Mayen Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SWZ', 'Swaziland ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SWE', 'Sweden ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('CHE', 'Switzerland ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('SYR', 'Syrian Arab Republic ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TJK', 'Tajikistan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('THA', 'Thailand ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('MKD', 'The former Yugoslav Republic of Macedonia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TLS', 'Timor-Leste');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TGO', 'Togo ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TKL', 'Tokelau ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TON', 'Tonga ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TTO', 'Trinidad and Tobago ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TUN', 'Tunisia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TUR', 'Turkey ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TKM', 'Turkmenistan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TCA', 'Turks and Caicos Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TUV', 'Tuvalu ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('UGA', 'Uganda ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('UKR', 'Ukraine ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ARE', 'United Arab Emirates ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('GBR', 'United Kingdom of Great Britain and Northern Ireland');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('TZA', 'United Republic of Tanzania ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('USA', 'United States of America');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('VIR', 'United States Virgin Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('URY', 'Uruguay ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('UZB', 'Uzbekistan ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('VUT', 'Vanuatu ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('VEN', 'Venezuela (Bolivarian Republic of)');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('VNM', 'Viet Nam ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('WLF', 'Wallis and Futuna Islands ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ESH', 'Western Sahara ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('YEM', 'Yemen ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ZMB', 'Zambia ');
|
||||||
|
INSERT INTO cc_country (isocode, name) VALUES ('ZWE', 'Zimbabwe ');
|
||||||
|
|
|
@ -30,6 +30,26 @@ CREATE INDEX "cc_access_parent_idx" ON "cc_access" ("parent");
|
||||||
|
|
||||||
CREATE INDEX "cc_access_token_idx" ON "cc_access" ("token");
|
CREATE INDEX "cc_access_token_idx" ON "cc_access" ("token");
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- cc_music_dirs
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE "cc_music_dirs" CASCADE;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "cc_music_dirs"
|
||||||
|
(
|
||||||
|
"id" serial NOT NULL,
|
||||||
|
"directory" TEXT,
|
||||||
|
"type" VARCHAR(255),
|
||||||
|
PRIMARY KEY ("id"),
|
||||||
|
CONSTRAINT "cc_music_dir_unique" UNIQUE ("directory")
|
||||||
|
);
|
||||||
|
|
||||||
|
COMMENT ON TABLE "cc_music_dirs" IS '';
|
||||||
|
|
||||||
|
|
||||||
|
SET search_path TO public;
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- cc_files
|
-- cc_files
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
@ -44,6 +64,7 @@ CREATE TABLE "cc_files"
|
||||||
"name" VARCHAR(255) default '' NOT NULL,
|
"name" VARCHAR(255) default '' NOT NULL,
|
||||||
"mime" VARCHAR(255) default '' NOT NULL,
|
"mime" VARCHAR(255) default '' NOT NULL,
|
||||||
"ftype" VARCHAR(128) default '' NOT NULL,
|
"ftype" VARCHAR(128) default '' NOT NULL,
|
||||||
|
"directory" INTEGER,
|
||||||
"filepath" TEXT default '',
|
"filepath" TEXT default '',
|
||||||
"state" VARCHAR(128) default 'empty' NOT NULL,
|
"state" VARCHAR(128) default 'empty' NOT NULL,
|
||||||
"currentlyaccessing" INTEGER default 0 NOT NULL,
|
"currentlyaccessing" INTEGER default 0 NOT NULL,
|
||||||
|
@ -421,11 +442,31 @@ CREATE TABLE "cc_subjs"
|
||||||
COMMENT ON TABLE "cc_subjs" IS '';
|
COMMENT ON TABLE "cc_subjs" IS '';
|
||||||
|
|
||||||
|
|
||||||
|
SET search_path TO public;
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- cc_country
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DROP TABLE "cc_country" CASCADE;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "cc_country"
|
||||||
|
(
|
||||||
|
"isocode" CHAR(3) NOT NULL,
|
||||||
|
"name" VARCHAR(255) NOT NULL,
|
||||||
|
PRIMARY KEY ("isocode")
|
||||||
|
);
|
||||||
|
|
||||||
|
COMMENT ON TABLE "cc_country" IS '';
|
||||||
|
|
||||||
|
|
||||||
SET search_path TO public;
|
SET search_path TO public;
|
||||||
ALTER TABLE "cc_access" ADD CONSTRAINT "cc_access_owner_fkey" FOREIGN KEY ("owner") REFERENCES "cc_subjs" ("id");
|
ALTER TABLE "cc_access" ADD CONSTRAINT "cc_access_owner_fkey" FOREIGN KEY ("owner") REFERENCES "cc_subjs" ("id");
|
||||||
|
|
||||||
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id");
|
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_files_editedby_fkey" FOREIGN KEY ("editedby") REFERENCES "cc_subjs" ("id");
|
||||||
|
|
||||||
|
ALTER TABLE "cc_files" ADD CONSTRAINT "cc_music_dirs_folder_fkey" FOREIGN KEY ("directory") REFERENCES "cc_music_dirs" ("id") ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey" FOREIGN KEY ("subj") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
|
ALTER TABLE "cc_perms" ADD CONSTRAINT "cc_perms_subj_fkey" FOREIGN KEY ("subj") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
|
ALTER TABLE "cc_show_instances" ADD CONSTRAINT "cc_show_fkey" FOREIGN KEY ("show_id") REFERENCES "cc_show" ("id") ON DELETE CASCADE;
|
||||||
|
@ -452,4 +493,6 @@ ALTER TABLE "cc_pref" ADD CONSTRAINT "cc_pref_subjid_fkey" FOREIGN KEY ("subjid"
|
||||||
|
|
||||||
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
|
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey" FOREIGN KEY ("instance_id") REFERENCES "cc_show_instances" ("id") ON DELETE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_file_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" FOREIGN KEY ("userid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
|
ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" FOREIGN KEY ("userid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# This file is part of the Airtime project.
|
|
||||||
# http://airtime.sourcefabric.org/
|
|
||||||
#
|
|
||||||
# Airtime is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Airtime is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Airtime; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Run this to set up the build system: configure, makefiles, etc.
|
|
||||||
# (based on the version in enlightenment's cvs)
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
package="GetId3"
|
|
||||||
|
|
||||||
# assume we're in $basedir/bin
|
|
||||||
reldir=`dirname $0`/..
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
test -z "$basedir" && basedir=.
|
|
||||||
|
|
||||||
bindir=$basedir/bin
|
|
||||||
etcdir=$basedir/etc
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
|
|
||||||
cd "$tmpdir"
|
|
||||||
DIE=0
|
|
||||||
|
|
||||||
(autoheader --version) < /dev/null > /dev/null 2>&1 || {
|
|
||||||
echo
|
|
||||||
echo "You must have autoconf installed to compile $package."
|
|
||||||
echo "Download the appropriate package for your distribution,"
|
|
||||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
|
||||||
DIE=1
|
|
||||||
}
|
|
||||||
|
|
||||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
|
||||||
echo
|
|
||||||
echo "You must have autoconf installed to compile $package."
|
|
||||||
echo "Download the appropriate package for your distribution,"
|
|
||||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
|
||||||
DIE=1
|
|
||||||
}
|
|
||||||
|
|
||||||
if test "$DIE" -eq 1; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$*"; then
|
|
||||||
echo "I am going to run ./configure with no arguments - if you wish "
|
|
||||||
echo "to pass any to it, please specify them on the $0 command line."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Generating configuration files for $package, please wait...."
|
|
||||||
|
|
||||||
configure_ac=${etcdir}/configure.ac
|
|
||||||
configure=${tmpdir}/configure
|
|
||||||
aclocal_m4=${tmpdir}/aclocal.m4
|
|
||||||
|
|
||||||
# copy over configure.ac and acinlclude.m4 from etc to tmp,
|
|
||||||
# as aclocal >= 1.8 is sooo unbelivably stupid that it will simply try to
|
|
||||||
# look for configure.ac in the current directory, and include acinclude.m4
|
|
||||||
# in aclocal.m4 it without a directory path in front
|
|
||||||
#ACLOCAL_FLAGS="-I ${tmpdir} --acdir=${tmpdir} --output=${aclocal_m4}"
|
|
||||||
#echo " aclocal $ACLOCAL_FLAGS"
|
|
||||||
#cp -f ${configure_ac} ${tmpdir}
|
|
||||||
#cp -f ${etcdir}/acinclude.m4 ${tmpdir}
|
|
||||||
#aclocal $ACLOCAL_FLAGS
|
|
||||||
|
|
||||||
#echo " autoheader ${configure_ac}"
|
|
||||||
#autoheader ${configure_ac}
|
|
||||||
|
|
||||||
echo " autoconf -I ${tmpdir} -o ${configure} ${configure_ac}"
|
|
||||||
autoconf -I ${tmpdir} -o ${configure} ${configure_ac}
|
|
||||||
|
|
47
airtime_mvc/library/getid3/configure
vendored
47
airtime_mvc/library/getid3/configure
vendored
|
@ -1,47 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# This file is part of the Airtime project.
|
|
||||||
# http://airtime.sourcefabric.org/
|
|
||||||
#
|
|
||||||
# Airtime is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Airtime is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Airtime; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Run this script to configure the environment.
|
|
||||||
#
|
|
||||||
# This script in effect calls the real automake / autoconf configure script
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# assume we're in $basedir
|
|
||||||
reldir=`dirname $0`
|
|
||||||
basedir=`cd $reldir; pwd;`
|
|
||||||
test -z "$basedir" && basedir=.
|
|
||||||
|
|
||||||
bindir=$basedir/bin
|
|
||||||
tmpdir=$basedir/tmp
|
|
||||||
|
|
||||||
|
|
||||||
autogen=$bindir/autogen.sh
|
|
||||||
configure=$tmpdir/configure
|
|
||||||
|
|
||||||
if [ ! -x $configure ]; then
|
|
||||||
(cd $basedir && $autogen "$@")
|
|
||||||
fi
|
|
||||||
|
|
||||||
(cd $tmpdir && $configure "$@")
|
|
||||||
|
|
|
@ -1,135 +0,0 @@
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# getID3 - read and writes tags in media files - see getid3.readme.txt
|
|
||||||
# getID3 by James Heinrich <getid3@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This file is part of the Airtime project.
|
|
||||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
#
|
|
||||||
# Airtime is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Airtime is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Airtime; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
# @configure_input@
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# General command definitions
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
SHELL = /bin/bash
|
|
||||||
MKDIR = mkdir -p
|
|
||||||
RM = rm -f
|
|
||||||
RMDIR = rm -rf
|
|
||||||
DOXYGEN = doxygen
|
|
||||||
CP = cp -f
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Misc
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
MODULE_NAME = getid3
|
|
||||||
TAR_C = tar -cj --exclude .svn --exclude '*~' -C ${BASE_DIR} -f
|
|
||||||
DIST_EXT = .tgz
|
|
||||||
DATE = `date +%y%m%d`
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Basic directory and file definitions
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#BASE_DIR = @builddir@
|
|
||||||
BASE_DIR = .
|
|
||||||
DOC_DIR = ${BASE_DIR}/doc
|
|
||||||
DOXYGEN_DIR = ${DOC_DIR}/doxygen
|
|
||||||
ETC_DIR = ${BASE_DIR}/etc
|
|
||||||
INCLUDE_DIR = ${BASE_DIR}/include
|
|
||||||
LIB_DIR = ${BASE_DIR}/lib
|
|
||||||
SRC_DIR = ${BASE_DIR}/src
|
|
||||||
TMP_DIR = ${BASE_DIR}/tmp
|
|
||||||
VAR_DIR = ${BASE_DIR}/var
|
|
||||||
|
|
||||||
prefix = @prefix@
|
|
||||||
|
|
||||||
USR_DIR = ${prefix}
|
|
||||||
USR_INCLUDE_DIR = ${USR_DIR}/include
|
|
||||||
USR_VAR_DIR = ${USR_DIR}/var
|
|
||||||
|
|
||||||
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
|
|
||||||
|
|
||||||
PHP_DIR = ${VAR_DIR}
|
|
||||||
#TEST_RUNNER = ${PHP_DIR}/tests/index.php
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Configuration parameters
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#CPPFLAGS = @CPPFLAGS@
|
|
||||||
#CXXFLAGS = @CXXFLAGS@ @DEFS@ -I${USR_INCLUDE_DIR} -I${INCLUDE_DIR} -I${TMP_DIR}\
|
|
||||||
# -pedantic -Wall
|
|
||||||
#LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} -L${LIB_DIR}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Dependencies
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#HELLO_LIB_OBJS = ${TMP_DIR}/Hello.o
|
|
||||||
#TEST_RUNNER_OBJS = ${TMP_DIR}/HelloTest.o ${TMP_DIR}/TestRunner.o
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Targets
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
.PHONY: all dir_setup doc clean docclean depclean distclean dist install
|
|
||||||
|
|
||||||
all: dir_setup
|
|
||||||
|
|
||||||
#dir_setup: ${TMP_DIR} ${DOXYGEN_DIR}
|
|
||||||
dir_setup: ${DOXYGEN_DIR}
|
|
||||||
|
|
||||||
doc:
|
|
||||||
${DOXYGEN} ${DOXYGEN_CONFIG}
|
|
||||||
|
|
||||||
clean:
|
|
||||||
# ${RM} ...
|
|
||||||
|
|
||||||
docclean:
|
|
||||||
${RMDIR} ${DOXYGEN_DIR}/html
|
|
||||||
|
|
||||||
depclean: clean
|
|
||||||
|
|
||||||
dist: all
|
|
||||||
${TAR_C} ${MODULE_NAME}${DATE}${DIST_EXT} *
|
|
||||||
|
|
||||||
distclean: clean docclean
|
|
||||||
# ${RMDIR} ${TMP_DIR}/config* ${TMP_DIR}/autom4te*
|
|
||||||
|
|
||||||
#check: all ${TEST_RUNNER}
|
|
||||||
# ${TEST_RUNNER}
|
|
||||||
check: all
|
|
||||||
|
|
||||||
install:
|
|
||||||
${MKDIR} ${USR_VAR_DIR}/Campcaster/getid3/var
|
|
||||||
${CP} ${VAR_DIR}/*.php ${USR_VAR_DIR}/Campcaster/getid3/var
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Specific targets
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
${DOXYGEN_DIR}:
|
|
||||||
${MKDIR} ${DOXYGEN_DIR}
|
|
||||||
|
|
||||||
#${TEST_RUNNER}:
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Pattern rules
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
#${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
|
|
||||||
# ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
|
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
dnl-----------------------------------------------------------------------------
|
|
||||||
dnl Copyright (c) 2010 Sourcefabric O.P.S.
|
|
||||||
dnl
|
|
||||||
dnl This file is part of the Airtime project.
|
|
||||||
dnl http://airtime.sourcefabric.org/
|
|
||||||
dnl
|
|
||||||
dnl Airtime is free software; you can redistribute it and/or modify
|
|
||||||
dnl it under the terms of the GNU General Public License as published by
|
|
||||||
dnl the Free Software Foundation; either version 2 of the License, or
|
|
||||||
dnl (at your option) any later version.
|
|
||||||
dnl
|
|
||||||
dnl Airtime is distributed in the hope that it will be useful,
|
|
||||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
dnl GNU General Public License for more details.
|
|
||||||
dnl
|
|
||||||
dnl You should have received a copy of the GNU General Public License
|
|
||||||
dnl along with Airtime; if not, write to the Free Software
|
|
||||||
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
dnl
|
|
||||||
dnl-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
dnl-----------------------------------------------------------------------------
|
|
||||||
dnl NOTE: Run all configure related scripts from the tmp directory of the
|
|
||||||
dnl project.
|
|
||||||
dnl This is due to the fact that configure spreads a lot of trash around,
|
|
||||||
dnl like atom4te cache directories, config.* files, etc. into the directory
|
|
||||||
dnl it is being run from. We clearly don't want these in our base directory.
|
|
||||||
dnl-----------------------------------------------------------------------------
|
|
||||||
AC_INIT(GetId3, 0.0, contact@sourcefabric.org)
|
|
||||||
AC_PREREQ(2.59)
|
|
||||||
AC_COPYRIGHT([Copyright (c) 2010 Sourcefabric O.P.S. under the GNU GPL])
|
|
||||||
AC_REVISION($Revision$)
|
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR(../var/getid3.php)
|
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES(../Makefile:../etc/Makefile.in)
|
|
||||||
|
|
||||||
AC_OUTPUT()
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,222 +0,0 @@
|
||||||
<?php
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
/// getID3() by James Heinrich <info@getid3.org> //
|
|
||||||
// available at http://getid3.sourceforge.net //
|
|
||||||
// or http://www.getid3.org //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// //
|
|
||||||
// extension.cache.dbm.php - part of getID3() //
|
|
||||||
// Please see readme.txt for more information //
|
|
||||||
// ///
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// //
|
|
||||||
// This extension written by Allan Hansen <ahØartemis*dk> //
|
|
||||||
// ///
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a caching extension for getID3(). It works the exact same
|
|
||||||
* way as the getID3 class, but return cached information very fast
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
*
|
|
||||||
* Normal getID3 usage (example):
|
|
||||||
*
|
|
||||||
* require_once 'getid3/getid3.php';
|
|
||||||
* $getID3 = new getID3;
|
|
||||||
* $getID3->encoding = 'UTF-8';
|
|
||||||
* $info1 = $getID3->analyze('file1.flac');
|
|
||||||
* $info2 = $getID3->analyze('file2.wv');
|
|
||||||
*
|
|
||||||
* getID3_cached usage:
|
|
||||||
*
|
|
||||||
* require_once 'getid3/getid3.php';
|
|
||||||
* require_once 'getid3/getid3/extension.cache.dbm.php';
|
|
||||||
* $getID3 = new getID3_cached('db3', '/tmp/getid3_cache.dbm',
|
|
||||||
* '/tmp/getid3_cache.lock');
|
|
||||||
* $getID3->encoding = 'UTF-8';
|
|
||||||
* $info1 = $getID3->analyze('file1.flac');
|
|
||||||
* $info2 = $getID3->analyze('file2.wv');
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Supported Cache Types
|
|
||||||
*
|
|
||||||
* SQL Databases: (use extension.cache.mysql)
|
|
||||||
*
|
|
||||||
* cache_type cache_options
|
|
||||||
* -------------------------------------------------------------------
|
|
||||||
* mysql host, database, username, password
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* DBM-Style Databases: (this extension)
|
|
||||||
*
|
|
||||||
* cache_type cache_options
|
|
||||||
* -------------------------------------------------------------------
|
|
||||||
* gdbm dbm_filename, lock_filename
|
|
||||||
* ndbm dbm_filename, lock_filename
|
|
||||||
* db2 dbm_filename, lock_filename
|
|
||||||
* db3 dbm_filename, lock_filename
|
|
||||||
* db4 dbm_filename, lock_filename (PHP5 required)
|
|
||||||
*
|
|
||||||
* PHP must have write access to both dbm_filename and lock_filename.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Recommended Cache Types
|
|
||||||
*
|
|
||||||
* Infrequent updates, many reads any DBM
|
|
||||||
* Frequent updates mysql
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
class getID3_cached_dbm extends getID3
|
|
||||||
{
|
|
||||||
|
|
||||||
// public: constructor - see top of this file for cache type and cache_options
|
|
||||||
function getID3_cached_dbm($cache_type, $dbm_filename, $lock_filename) {
|
|
||||||
|
|
||||||
// Check for dba extension
|
|
||||||
if (!extension_loaded('dba')) {
|
|
||||||
die('PHP is not compiled with dba support, required to use DBM style cache.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for specific dba driver
|
|
||||||
if (function_exists('dba_handlers')) { // PHP 4.3.0+
|
|
||||||
if (!in_array('db3', dba_handlers())) {
|
|
||||||
die('PHP is not compiled --with '.$cache_type.' support, required to use DBM style cache.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // PHP <= 4.2.3
|
|
||||||
ob_start(); // nasty, buy the only way to check...
|
|
||||||
phpinfo();
|
|
||||||
$contents = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
if (!strstr($contents, $cache_type)) {
|
|
||||||
die('PHP is not compiled --with '.$cache_type.' support, required to use DBM style cache.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create lock file if needed
|
|
||||||
if (!file_exists($lock_filename)) {
|
|
||||||
if (!touch($lock_filename)) {
|
|
||||||
die('failed to create lock file: ' . $lock_filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open lock file for writing
|
|
||||||
if (!is_writeable($lock_filename)) {
|
|
||||||
die('lock file: ' . $lock_filename . ' is not writable');
|
|
||||||
}
|
|
||||||
$this->lock = fopen($lock_filename, 'w');
|
|
||||||
|
|
||||||
// Acquire exclusive write lock to lock file
|
|
||||||
flock($this->lock, LOCK_EX);
|
|
||||||
|
|
||||||
// Create dbm-file if needed
|
|
||||||
if (!file_exists($dbm_filename)) {
|
|
||||||
if (!touch($dbm_filename)) {
|
|
||||||
die('failed to create dbm file: ' . $dbm_filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to open dbm file for writing
|
|
||||||
$this->dba = @dba_open($dbm_filename, 'w', $cache_type);
|
|
||||||
if (!$this->dba) {
|
|
||||||
|
|
||||||
// Failed - create new dbm file
|
|
||||||
$this->dba = dba_open($dbm_filename, 'n', $cache_type);
|
|
||||||
|
|
||||||
if (!$this->dba) {
|
|
||||||
die('failed to create dbm file: ' . $dbm_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert getID3 version number
|
|
||||||
dba_insert(GETID3_VERSION, GETID3_VERSION, $this->dba);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init misc values
|
|
||||||
$this->cache_type = $cache_type;
|
|
||||||
$this->dbm_filename = $dbm_filename;
|
|
||||||
|
|
||||||
// Register destructor
|
|
||||||
register_shutdown_function(array($this, '__destruct'));
|
|
||||||
|
|
||||||
// Check version number and clear cache if changed
|
|
||||||
if (dba_fetch(GETID3_VERSION, $this->dba) != GETID3_VERSION) {
|
|
||||||
$this->clear_cache();
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::getID3();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public: destuctor
|
|
||||||
function __destruct() {
|
|
||||||
|
|
||||||
// Close dbm file
|
|
||||||
@dba_close($this->dba);
|
|
||||||
|
|
||||||
// Release exclusive lock
|
|
||||||
@flock($this->lock, LOCK_UN);
|
|
||||||
|
|
||||||
// Close lock file
|
|
||||||
@fclose($this->lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public: clear cache
|
|
||||||
function clear_cache() {
|
|
||||||
|
|
||||||
// Close dbm file
|
|
||||||
dba_close($this->dba);
|
|
||||||
|
|
||||||
// Create new dbm file
|
|
||||||
$this->dba = dba_open($this->dbm_filename, 'n', $this->cache_type);
|
|
||||||
|
|
||||||
if (!$this->dba) {
|
|
||||||
die('failed to clear cache/recreate dbm file: ' . $this->dbm_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert getID3 version number
|
|
||||||
dba_insert(GETID3_VERSION, GETID3_VERSION, $this->dba);
|
|
||||||
|
|
||||||
// Reregister shutdown function
|
|
||||||
register_shutdown_function(array($this, '__destruct'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public: analyze file
|
|
||||||
function analyze($filename) {
|
|
||||||
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
|
|
||||||
// Calc key filename::mod_time::size - should be unique
|
|
||||||
$key = $filename . '::' . filemtime($filename) . '::' . filesize($filename);
|
|
||||||
|
|
||||||
// Loopup key
|
|
||||||
$result = dba_fetch($key, $this->dba);
|
|
||||||
|
|
||||||
// Hit
|
|
||||||
if ($result !== false) {
|
|
||||||
return unserialize($result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Miss
|
|
||||||
$result = parent::analyze($filename);
|
|
||||||
|
|
||||||
// Save result
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
dba_insert($key, serialize($result), $this->dba);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
|
@ -1,171 +0,0 @@
|
||||||
<?php
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
/// getID3() by James Heinrich <info@getid3.org> //
|
|
||||||
// available at http://getid3.sourceforge.net //
|
|
||||||
// or http://www.getid3.org //
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// //
|
|
||||||
// extension.cache.mysql.php - part of getID3() //
|
|
||||||
// Please see readme.txt for more information //
|
|
||||||
// ///
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
// //
|
|
||||||
// This extension written by Allan Hansen <ahØartemis*dk> //
|
|
||||||
// ///
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a caching extension for getID3(). It works the exact same
|
|
||||||
* way as the getID3 class, but return cached information very fast
|
|
||||||
*
|
|
||||||
* Example: (see also demo.cache.mysql.php in /demo/)
|
|
||||||
*
|
|
||||||
* Normal getID3 usage (example):
|
|
||||||
*
|
|
||||||
* require_once 'getid3/getid3.php';
|
|
||||||
* $getID3 = new getID3;
|
|
||||||
* $getID3->encoding = 'UTF-8';
|
|
||||||
* $info1 = $getID3->analyze('file1.flac');
|
|
||||||
* $info2 = $getID3->analyze('file2.wv');
|
|
||||||
*
|
|
||||||
* getID3_cached usage:
|
|
||||||
*
|
|
||||||
* require_once 'getid3/getid3.php';
|
|
||||||
* require_once 'getid3/getid3/extension.cache.mysql.php';
|
|
||||||
* $getID3 = new getID3_cached_mysql('localhost', 'database',
|
|
||||||
* 'username', 'password');
|
|
||||||
* $getID3->encoding = 'UTF-8';
|
|
||||||
* $info1 = $getID3->analyze('file1.flac');
|
|
||||||
* $info2 = $getID3->analyze('file2.wv');
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Supported Cache Types (this extension)
|
|
||||||
*
|
|
||||||
* SQL Databases:
|
|
||||||
*
|
|
||||||
* cache_type cache_options
|
|
||||||
* -------------------------------------------------------------------
|
|
||||||
* mysql host, database, username, password
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* DBM-Style Databases: (use extension.cache.dbm)
|
|
||||||
*
|
|
||||||
* cache_type cache_options
|
|
||||||
* -------------------------------------------------------------------
|
|
||||||
* gdbm dbm_filename, lock_filename
|
|
||||||
* ndbm dbm_filename, lock_filename
|
|
||||||
* db2 dbm_filename, lock_filename
|
|
||||||
* db3 dbm_filename, lock_filename
|
|
||||||
* db4 dbm_filename, lock_filename (PHP5 required)
|
|
||||||
*
|
|
||||||
* PHP must have write access to both dbm_filename and lock_filename.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Recommended Cache Types
|
|
||||||
*
|
|
||||||
* Infrequent updates, many reads any DBM
|
|
||||||
* Frequent updates mysql
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
class getID3_cached_mysql extends getID3
|
|
||||||
{
|
|
||||||
|
|
||||||
// private vars
|
|
||||||
var $cursor;
|
|
||||||
var $connection;
|
|
||||||
|
|
||||||
|
|
||||||
// public: constructor - see top of this file for cache type and cache_options
|
|
||||||
function getID3_cached_mysql($host, $database, $username, $password) {
|
|
||||||
|
|
||||||
// Check for mysql support
|
|
||||||
if (!function_exists('mysql_pconnect')) {
|
|
||||||
die('PHP not compiled with mysql support.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect to database
|
|
||||||
$this->connection = mysql_pconnect($host, $username, $password);
|
|
||||||
if (!$this->connection) {
|
|
||||||
die('mysql_pconnect() failed - check permissions and spelling.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select database
|
|
||||||
if (!mysql_select_db($database, $this->connection)) {
|
|
||||||
die('Cannot use database '.$database);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create cache table if not exists
|
|
||||||
$this->create_table();
|
|
||||||
|
|
||||||
// Check version number and clear cache if changed
|
|
||||||
$this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename` = '".GETID3_VERSION."') AND (`filesize` = '-1') AND (`filetime` = '-1') AND (`analyzetime` = '-1')", $this->connection);
|
|
||||||
list($version) = @mysql_fetch_array($this->cursor);
|
|
||||||
if ($version != GETID3_VERSION) {
|
|
||||||
$this->clear_cache();
|
|
||||||
}
|
|
||||||
|
|
||||||
parent::getID3();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public: clear cache
|
|
||||||
function clear_cache() {
|
|
||||||
|
|
||||||
$this->cursor = mysql_query("DELETE FROM `getid3_cache`", $this->connection);
|
|
||||||
$this->cursor = mysql_query("INSERT INTO `getid3_cache` VALUES ('".GETID3_VERSION."', -1, -1, -1, '".GETID3_VERSION."')", $this->connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public: analyze file
|
|
||||||
function analyze($filename) {
|
|
||||||
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
|
|
||||||
// Short-hands
|
|
||||||
$filetime = filemtime($filename);
|
|
||||||
$filesize = filesize($filename);
|
|
||||||
$filenam2 = mysql_escape_string($filename);
|
|
||||||
|
|
||||||
// Loopup file
|
|
||||||
$this->cursor = mysql_query("SELECT `value` FROM `getid3_cache` WHERE (`filename`='".$filenam2."') AND (`filesize`='".$filesize."') AND (`filetime`='".$filetime."')", $this->connection);
|
|
||||||
list($result) = @mysql_fetch_array($this->cursor);
|
|
||||||
|
|
||||||
// Hit
|
|
||||||
if ($result) {
|
|
||||||
return unserialize($result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Miss
|
|
||||||
$result = parent::analyze($filename);
|
|
||||||
|
|
||||||
// Save result
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
$res2 = mysql_escape_string(serialize($result));
|
|
||||||
$this->cursor = mysql_query("INSERT INTO `getid3_cache` (`filename`, `filesize`, `filetime`, `analyzetime`, `value`) VALUES ('".$filenam2."', '".$filesize."', '".$filetime."', '".time()."', '".$res2."')", $this->connection);
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// private: (re)create sql table
|
|
||||||
function create_table($drop = false) {
|
|
||||||
|
|
||||||
$this->cursor = mysql_query("CREATE TABLE IF NOT EXISTS `getid3_cache` (
|
|
||||||
`filename` VARCHAR(255) NOT NULL DEFAULT '',
|
|
||||||
`filesize` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`filetime` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`analyzetime` INT(11) NOT NULL DEFAULT '0',
|
|
||||||
`value` TEXT NOT NULL,
|
|
||||||
PRIMARY KEY (`filename`,`filesize`,`filetime`)) TYPE=MyISAM", $this->connection);
|
|
||||||
echo mysql_error($this->connection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
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