diff --git a/LICENSE_3RD_PARTY b/LICENSE_3RD_PARTY index fff6fc84d..b32dd6d06 100644 --- a/LICENSE_3RD_PARTY +++ b/LICENSE_3RD_PARTY @@ -112,6 +112,10 @@ Non-linked code: - Web site: http://code.google.com/p/jq-serverbrowse/ - License: BSD 2-Clause + * Flot + - Web site: http://www.flotcharts.org/ + - License: MIT + ------------- Media-Monitor ------------- diff --git a/README b/README index 0747ce34a..6f743e9d3 100644 --- a/README +++ b/README @@ -8,7 +8,7 @@ Home page: http://airtime.sourcefabric.org/ Major features: * Web-based remote station management. Authorized personnel can add - program material, create playlists, and schedule programming all via + program material, create playlists and schedule programming all via a web interface. * Automation. Airtime has a scheduler function that enables users to set shows with playlists for playback at a date and time of their choosing. diff --git a/VERSION b/VERSION index 491e6ae5c..7c1777d22 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ PRODUCT_ID=Airtime -PRODUCT_RELEASE=2.2.1 +PRODUCT_RELEASE=2.3.0 diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 3ca0e9e79..6f2f293f7 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -1,5 +1,8 @@ registerPlugin(new RabbitMqPlugin()); +//localization configuration +Application_Model_Locale::configureLocalization(); /* The bootstrap class should only be used to initialize actions that return a view. Actions that return JSON will not use the bootstrap class! */ @@ -42,47 +47,72 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } + + protected function _initGlobals() + { + $view = $this->getResource('view'); + $baseUrl = Application_Common_OsPath::getBaseDir(); + + $view->headScript()->appendScript("var baseUrl = '$baseUrl'"); + + $user = Application_Model_User::GetCurrentUser(); + if (!is_null($user)){ + $userType = $user->getType(); + } else { + $userType = ""; + } + $view->headScript()->appendScript("var userType = '$userType';"); + + } protected function _initHeadLink() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $view = $this->getResource('view'); - $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); - $view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css?'.$CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl.'/css/styles.css?'.$CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl.'/css/masterpanel.css?'.$CC_CONFIG['airtime_version']); - $view->headLink()->appendStylesheet($baseUrl.'/css/bootstrap.css?'.$CC_CONFIG['airtime_version']); + $baseUrl = Application_Common_OsPath::getBaseDir(); + + $view->headLink()->appendStylesheet($baseUrl.'css/redmond/jquery-ui-1.8.8.custom.css?'.$CC_CONFIG['airtime_version']); + $view->headLink()->appendStylesheet($baseUrl.'css/pro_dropdown_3.css?'.$CC_CONFIG['airtime_version']); + $view->headLink()->appendStylesheet($baseUrl.'css/qtip/jquery.qtip.min.css?'.$CC_CONFIG['airtime_version']); + $view->headLink()->appendStylesheet($baseUrl.'css/styles.css?'.$CC_CONFIG['airtime_version']); + $view->headLink()->appendStylesheet($baseUrl.'css/masterpanel.css?'.$CC_CONFIG['airtime_version']); + $view->headLink()->appendStylesheet($baseUrl.'css/bootstrap.css?'.$CC_CONFIG['airtime_version']); + $view->headLink()->appendStylesheet($baseUrl.'css/tipsy/jquery.tipsy.css?'.$CC_CONFIG['airtime_version']); } protected function _initHeadScript() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $view = $this->getResource('view'); - $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); - - $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $view->headScript()->appendScript("var baseUrl='$baseUrl/'"); - + + $baseUrl = Application_Common_OsPath::getBaseDir(); + + $view->headScript()->appendFile($baseUrl.'js/libs/jquery-1.7.2.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/libs/jquery-ui-1.8.18.custom.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/libs/jquery.stickyPanel.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/qtip/jquery.qtip.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/jplayer/jquery.jplayer.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/sprintf/sprintf-0.7-beta1.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/bootstrap/bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/cookie/jquery.cookie.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/i18n/jquery.i18n.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'locale/general-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'locale/datatables-translation-table?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendScript("$.i18n.setDictionary(general_dict)"); + $view->headScript()->appendScript("var baseUrl='$baseUrl'"); + //scripts for now playing bar - $view->headScript()->appendFile($baseUrl.'/js/airtime/airtime_bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/dashboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/airtime/airtime_bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/airtime/dashboard/dashboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/airtime/dashboard/versiontooltip.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/tipsy/jquery.tipsy.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - - $view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $view->headScript()->appendFile($baseUrl.'/js/airtime/common/audioplaytest.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/airtime/common/audioplaytest.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $user = Application_Model_User::getCurrentUser(); if (!is_null($user)){ @@ -103,8 +133,18 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap } if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) { - $view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $view->headScript()->appendFile($baseUrl.'js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); } + + if (Application_Model_Preference::GetPlanLevel() != "disabled" + && !($_SERVER['REQUEST_URI'] == $baseUrl.'Dashboard/stream-player' || + strncmp($_SERVER['REQUEST_URI'], $baseUrl.'audiopreview/audio-preview', strlen($baseUrl.'audiopreview/audio-preview'))==0)) { + + $client_id = Application_Model_Preference::GetClientId(); + $view->headScript()->appendScript("var livechat_client_id = '$client_id';"); + $view->headScript()->appendFile($baseUrl . 'js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + } + } protected function _initViewHelpers() @@ -122,7 +162,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap protected function _initZFDebug() { - Zend_Controller_Front::getInstance()->throwExceptions(true); + Zend_Controller_Front::getInstance()->throwExceptions(true); /* if (APPLICATION_ENV == "development") { diff --git a/airtime_mvc/application/common/DateHelper.php b/airtime_mvc/application/common/DateHelper.php index a22a26b4a..cc02544cd 100644 --- a/airtime_mvc/application/common/DateHelper.php +++ b/airtime_mvc/application/common/DateHelper.php @@ -332,10 +332,10 @@ class Application_Common_DateHelper // if year is < 1753 or > 9999 it's out of range if ($year < 1753) { $retVal['success'] = false; - $retVal['errMsg'] = "The year '$year' must be within the range of 1753 - 9999"; + $retVal['errMsg'] = sprintf(_("The year %s must be within the range of 1753 - 9999"), $year); } else if (!checkdate($month, $day, $year)) { $retVal['success'] = false; - $retVal['errMsg'] = "'$year-$month-$day' is not a valid date"; + $retVal['errMsg'] = sprintf(_("%s-%s-%s is not a valid date"), $year, $month, $day); } else { // check time if (isset($timeInfo)) { @@ -359,7 +359,7 @@ class Application_Common_DateHelper if ( ($hour < 0 || $hour > 23) || ($min < 0 || $min > 59) || ($sec < 0 || $sec > 59) ) { $retVal['success'] = false; - $retVal['errMsg'] = "'$timeInfo[0]:$timeInfo[1]:$timeInfo[2]' is not a valid time"; + $retVal['errMsg'] = sprintf(_("%s:%s:%s is not a valid time"), $timeInfo[0], $timeInfo[1] ,$timeInfo[2]); } } } diff --git a/airtime_mvc/application/common/OsPath.php b/airtime_mvc/application/common/OsPath.php index d9d9b6eff..64c1c1e4a 100644 --- a/airtime_mvc/application/common/OsPath.php +++ b/airtime_mvc/application/common/OsPath.php @@ -63,4 +63,18 @@ class Application_Common_OsPath{ return join(DIRECTORY_SEPARATOR, $paths); } + + public static function getBaseDir() { + $baseUrl = dirname($_SERVER['SCRIPT_NAME']); + + if ($baseUrl[0] != "/") { + $baseUrl = "/".$baseUrl; + } + + if ($baseUrl[strlen($baseUrl) -1] != "/") { + $baseUrl = $baseUrl."/"; + } + + return $baseUrl; + } } diff --git a/airtime_mvc/application/common/Timezone.php b/airtime_mvc/application/common/Timezone.php new file mode 100644 index 000000000..271ea5f02 --- /dev/null +++ b/airtime_mvc/application/common/Timezone.php @@ -0,0 +1,31 @@ + DateTimeZone::AFRICA, + 'America' => DateTimeZone::AMERICA, + 'Antarctica' => DateTimeZone::ANTARCTICA, + 'Arctic' => DateTimeZone::ARCTIC, + 'Asia' => DateTimeZone::ASIA, + 'Atlantic' => DateTimeZone::ATLANTIC, + 'Australia' => DateTimeZone::AUSTRALIA, + 'Europe' => DateTimeZone::EUROPE, + 'Indian' => DateTimeZone::INDIAN, + 'Pacific' => DateTimeZone::PACIFIC + ); + + $tzlist = array(); + + foreach ($regions as $name => $mask) { + $ids = DateTimeZone::listIdentifiers($mask); + foreach ($ids as $id) { + $tzlist[$id] = str_replace("_", " ", $id); + } + } + + return $tzlist; + } +} diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index 6687011a4..a23846a99 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -26,18 +26,21 @@ $ccAcl->add(new Zend_Acl_Resource('library')) ->add(new Zend_Acl_Resource('listenerstat')) ->add(new Zend_Acl_Resource('usersettings')) ->add(new Zend_Acl_Resource('audiopreview')) - ->add(new Zend_Acl_Resource('webstream')); + ->add(new Zend_Acl_Resource('webstream')) + ->add(new Zend_Acl_Resource('locale')); /** Creating permissions */ $ccAcl->allow('G', 'index') ->allow('G', 'login') ->allow('G', 'error') + ->allow('G', 'user', 'edit-user') ->allow('G', 'showbuilder') ->allow('G', 'api') ->allow('G', 'schedule') ->allow('G', 'dashboard') ->allow('G', 'audiopreview') ->allow('G', 'webstream') + ->allow('G', 'locale') ->allow('H', 'preference', 'is-import-in-progress') ->allow('H', 'usersettings') ->allow('H', 'plupload') diff --git a/airtime_mvc/application/configs/airtime-conf-production.php b/airtime_mvc/application/configs/airtime-conf-production.php index c880f6342..aaef0e371 100644 --- a/airtime_mvc/application/configs/airtime-conf-production.php +++ b/airtime_mvc/application/configs/airtime-conf-production.php @@ -8,7 +8,7 @@ * that the user can customize these. */ -global $CC_CONFIG; +$CC_CONFIG = Config::getConfig(); $dbhost = $CC_CONFIG['dsn']['hostspec']; $dbname = $CC_CONFIG['dsn']['database']; diff --git a/airtime_mvc/application/configs/airtime-conf.php b/airtime_mvc/application/configs/airtime-conf.php index 5ec20343b..c717a858e 100644 --- a/airtime_mvc/application/configs/airtime-conf.php +++ b/airtime_mvc/application/configs/airtime-conf.php @@ -1,6 +1,6 @@ array ( diff --git a/airtime_mvc/application/configs/classmap-airtime-conf.php b/airtime_mvc/application/configs/classmap-airtime-conf.php index bc786f729..ef0357425 100644 --- a/airtime_mvc/application/configs/classmap-airtime-conf.php +++ b/airtime_mvc/application/configs/classmap-airtime-conf.php @@ -197,4 +197,11 @@ return array ( 'BaseCcListenerCountPeer' => 'airtime/om/BaseCcListenerCountPeer.php', 'BaseCcListenerCount' => 'airtime/om/BaseCcListenerCount.php', 'BaseCcListenerCountQuery' => 'airtime/om/BaseCcListenerCountQuery.php', + 'CcLocaleTableMap' => 'airtime/map/CcLocaleTableMap.php', + 'CcLocalePeer' => 'airtime/CcLocalePeer.php', + 'CcLocale' => 'airtime/CcLocale.php', + 'CcLocaleQuery' => 'airtime/CcLocaleQuery.php', + 'BaseCcLocalePeer' => 'airtime/om/BaseCcLocalePeer.php', + 'BaseCcLocale' => 'airtime/om/BaseCcLocale.php', + 'BaseCcLocaleQuery' => 'airtime/om/BaseCcLocaleQuery.php', ); \ No newline at end of file diff --git a/airtime_mvc/application/configs/conf.php b/airtime_mvc/application/configs/conf.php index acaa94ac7..76b94f429 100644 --- a/airtime_mvc/application/configs/conf.php +++ b/airtime_mvc/application/configs/conf.php @@ -6,53 +6,20 @@ * /etc/airtime/recorder.cfg */ -global $CC_CONFIG; - -$CC_CONFIG = array( - // prefix for table names in the database - 'tblNamePrefix' => 'cc_', - - /* ================================================ storage configuration */ - - 'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A', - 'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs', - - "rootDir" => __DIR__."/../.." -); - - -$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf"; -Config::loadConfig($configFile); - -// Add database table names -$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist'; -$CC_CONFIG['playListContentsTable'] = $CC_CONFIG['tblNamePrefix'].'playlistcontents'; -$CC_CONFIG['filesTable'] = $CC_CONFIG['tblNamePrefix'].'files'; -$CC_CONFIG['accessTable'] = $CC_CONFIG['tblNamePrefix'].'access'; -$CC_CONFIG['permTable'] = $CC_CONFIG['tblNamePrefix'].'perms'; -$CC_CONFIG['sessTable'] = $CC_CONFIG['tblNamePrefix'].'sess'; -$CC_CONFIG['subjTable'] = $CC_CONFIG['tblNamePrefix'].'subjs'; -$CC_CONFIG['smembTable'] = $CC_CONFIG['tblNamePrefix'].'smemb'; -$CC_CONFIG['prefTable'] = $CC_CONFIG['tblNamePrefix'].'pref'; -$CC_CONFIG['scheduleTable'] = $CC_CONFIG['tblNamePrefix'].'schedule'; -$CC_CONFIG['playListTimeView'] = $CC_CONFIG['tblNamePrefix'].'playlisttimes'; -$CC_CONFIG['showSchedule'] = $CC_CONFIG['tblNamePrefix'].'show_schedule'; -$CC_CONFIG['showDays'] = $CC_CONFIG['tblNamePrefix'].'show_days'; -$CC_CONFIG['showTable'] = $CC_CONFIG['tblNamePrefix'].'show'; -$CC_CONFIG['showInstances'] = $CC_CONFIG['tblNamePrefix'].'show_instances'; - -$CC_CONFIG['playListSequence'] = $CC_CONFIG['playListTable'].'_id'; -$CC_CONFIG['filesSequence'] = $CC_CONFIG['filesTable'].'_id'; -$CC_CONFIG['prefSequence'] = $CC_CONFIG['prefTable'].'_id'; -$CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id'; -$CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id'; -$CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id'; - class Config { - public static function loadConfig($p_path) { - global $CC_CONFIG; + private static $CC_CONFIG; + public static function loadConfig() { + $CC_CONFIG = array( + /* ================================================ storage configuration */ - $filename = $p_path; + 'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A', + 'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs', + + "rootDir" => __DIR__."/../.." + ); + + $filename = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf"; + $values = parse_ini_file($filename, true); // Name of the web server user @@ -61,6 +28,7 @@ class Config { $CC_CONFIG['baseUrl'] = $values['general']['base_url']; $CC_CONFIG['basePort'] = $values['general']['base_port']; + $CC_CONFIG['phpDir'] = $values['general']['airtime_dir']; $CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours']; @@ -85,6 +53,17 @@ class Config { if(isset($values['demo']['demo'])){ $CC_CONFIG['demo'] = $values['demo']['demo']; - } + } + self::$CC_CONFIG = $CC_CONFIG; + } + + public static function setAirtimeVersion() { + $airtime_version = Application_Model_Preference::GetAirtimeVersion(); + $uniqueid = Application_Model_Preference::GetUniqueId(); + self::$CC_CONFIG['airtime_version'] = md5($airtime_version.$uniqueid); + } + + public static function getConfig() { + return self::$CC_CONFIG; } } diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index eb5cb3989..4a1f3e55a 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -32,6 +32,8 @@ define('MDATA_KEY_CONDUCTOR' , 'conductor'); define('MDATA_KEY_LANGUAGE' , 'language'); define('MDATA_KEY_REPLAYGAIN' , 'replay_gain'); define('MDATA_KEY_OWNER_ID' , 'owner_id'); +define('MDATA_KEY_CUE_IN' , 'cuein'); +define('MDATA_KEY_CUE_OUT' , 'cueout'); define('UI_MDATA_VALUE_FORMAT_FILE' , 'File'); define('UI_MDATA_VALUE_FORMAT_STREAM' , 'live stream'); diff --git a/airtime_mvc/application/configs/db-conf.php b/airtime_mvc/application/configs/db-conf.php index 493d8e9b0..05d3d938e 100644 --- a/airtime_mvc/application/configs/db-conf.php +++ b/airtime_mvc/application/configs/db-conf.php @@ -5,14 +5,6 @@ * yet available because airtime.conf hasn't been updated yet. This situation ends up throwing a lot of errors to stdout. * airtime*/ -global $CC_CONFIG; +require_once("conf.php"); -$filename = "/etc/airtime/airtime.conf"; -$values = parse_ini_file($filename, true); - -// Database config -$CC_CONFIG['dsn']['username'] = $values['database']['dbuser']; -$CC_CONFIG['dsn']['password'] = $values['database']['dbpass']; -$CC_CONFIG['dsn']['hostspec'] = $values['database']['host']; -$CC_CONFIG['dsn']['phptype'] = 'pgsql'; -$CC_CONFIG['dsn']['database'] = $values['database']['dbname']; +$CC_CONFIG = Config::getConfig(); diff --git a/airtime_mvc/application/configs/navigation.php b/airtime_mvc/application/configs/navigation.php index 59ce874fe..32b4af39d 100644 --- a/airtime_mvc/application/configs/navigation.php +++ b/airtime_mvc/application/configs/navigation.php @@ -9,85 +9,85 @@ */ $pages = array( array( - 'label' => 'Now Playing', + 'label' => _('Now Playing'), 'module' => 'default', 'controller' => 'Showbuilder', 'action' => 'index', 'resource' => 'showbuilder' ), array( - 'label' => 'Add Media', + 'label' => _('Add Media'), 'module' => 'default', 'controller' => 'Plupload', 'action' => 'index', 'resource' => 'plupload' ), array( - 'label' => 'Library', + 'label' => _('Library'), 'module' => 'default', 'controller' => 'Library', 'action' => 'index', 'resource' => 'playlist' ), array( - 'label' => 'Calendar', + 'label' => _('Calendar'), 'module' => 'default', 'controller' => 'Schedule', 'action' => 'index', 'resource' => 'schedule' ), array( - 'label' => 'System', + 'label' => _('System'), 'uri' => '#', 'resource' => 'preference', 'pages' => array( array( - 'label' => 'Preferences', + 'label' => _('Preferences'), 'module' => 'default', 'controller' => 'Preference' ), array( - 'label' => 'Users', + 'label' => _('Users'), 'module' => 'default', 'controller' => 'user', 'action' => 'add-user', 'resource' => 'user' ), array( - 'label' => 'Media Folders', + 'label' => _('Media Folders'), 'module' => 'default', 'controller' => 'Preference', 'action' => 'directory-config', 'id' => 'manage_folder' ), array( - 'label' => 'Streams', + 'label' => _('Streams'), 'module' => 'default', 'controller' => 'Preference', 'action' => 'stream-setting' ), array( - 'label' => 'Support Feedback', + 'label' => _('Support Feedback'), 'module' => 'default', 'controller' => 'Preference', 'action' => 'support-setting' ), array( - 'label' => 'Status', + 'label' => _('Status'), 'module' => 'default', 'controller' => 'systemstatus', 'action' => 'index', 'resource' => 'systemstatus' ), array( - 'label' => 'Playout History', + 'label' => _('Playout History'), 'module' => 'default', 'controller' => 'playouthistory', 'action' => 'index', 'resource' => 'playouthistory' ), array( - 'label' => 'Listener Stats', + 'label' => _('Listener Stats'), 'module' => 'default', 'controller' => 'listenerstat', 'action' => 'index', @@ -96,24 +96,24 @@ $pages = array( ) ), array( - 'label' => 'Help', + 'label' => _('Help'), 'uri' => '#', 'resource' => 'dashboard', 'pages' => array( array( - 'label' => 'Getting Started', + 'label' => _('Getting Started'), 'module' => 'default', 'controller' => 'dashboard', 'action' => 'help', 'resource' => 'dashboard' ), array( - 'label' => 'User Manual', + 'label' => _('User Manual'), 'uri' => "http://www.sourcefabric.org/en/airtime/manuals/", 'target' => "_blank" ), array( - 'label' => 'About', + 'label' => _('About'), 'module' => 'default', 'controller' => 'dashboard', 'action' => 'about', diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 8b4b0ebd8..baf6ad04c 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -42,18 +42,19 @@ class ApiController extends Zend_Controller_Action ->addActionContext('notify-webstream-data' , 'json') ->addActionContext('get-stream-parameters' , 'json') ->addActionContext('push-stream-stats' , 'json') + ->addActionContext('update-stream-setting-table' , 'json') ->initContext(); } public function checkAuth() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $api_key = $this->_getParam('api_key'); if (!in_array($api_key, $CC_CONFIG["apiKey"]) && is_null(Zend_Auth::getInstance()->getStorage()->read())) { 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; } } @@ -80,7 +81,7 @@ class ApiController extends Zend_Controller_Action if (is_null(Zend_Auth::getInstance()->getStorage()->read())) { header('HTTP/1.0 401 Unauthorized'); - print 'You are not allowed to access this resource.'; + print _('You are not allowed to access this resource.'); return; } @@ -282,7 +283,7 @@ class ApiController extends Zend_Controller_Action echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); } else { 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; } } @@ -321,7 +322,7 @@ class ApiController extends Zend_Controller_Action echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); } else { 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; } } @@ -490,6 +491,7 @@ class ApiController extends Zend_Controller_Action // If the file already exists we will update and make sure that // it's marked as 'exists'. $file->setFileExistsFlag(true); + $file->setFileHiddenFlag(false); $file->setMetadata($md); } if ($md['is_record'] != 0) { @@ -502,7 +504,7 @@ class ApiController extends Zend_Controller_Action //File is not in database anymore. if (is_null($file)) { - $return_hash['error'] = "File does not exist in Airtime."; + $return_hash['error'] = _("File does not exist in Airtime."); return $return_hash; } @@ -515,7 +517,7 @@ class ApiController extends Zend_Controller_Action $md['MDATA_KEY_ORIGINAL_PATH']); if (is_null($file)) { - $return_hash['error'] = 'File does not exist in Airtime'; + $return_hash['error'] = _('File does not exist in Airtime'); } else { $filepath = $md['MDATA_KEY_FILEPATH']; //$filepath = str_replace("\\", "", $filepath); @@ -527,7 +529,7 @@ class ApiController extends Zend_Controller_Action $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { - $return_hash['error'] = "File doesn't exist in Airtime."; + $return_hash['error'] = _("File doesn't exist in Airtime."); Logging::warn("Attempt to delete file that doesn't exist. Path: '$filepath'"); @@ -573,7 +575,7 @@ class ApiController extends Zend_Controller_Action Logging::info("Received bad request(key=$k), no 'mode' parameter. Bad request is:"); Logging::info( $info_json ); array_push( $responses, array( - 'error' => "Bad request. no 'mode' parameter passed.", + 'error' => _("Bad request. no 'mode' parameter passed."), 'key' => $k)); continue; } elseif ( !in_array($info_json['mode'], $valid_modes) ) { @@ -583,7 +585,7 @@ class ApiController extends Zend_Controller_Action Logging::info("Received bad request(key=$k). 'mode' parameter was invalid with value: '$mode'. Request:"); Logging::info( $info_json ); array_push( $responses, array( - 'error' => "Bad request. 'mode' parameter is invalid", + 'error' => _("Bad request. 'mode' parameter is invalid"), 'key' => $k, 'mode' => $mode ) ); continue; @@ -953,7 +955,7 @@ class ApiController extends Zend_Controller_Action $data_arr = json_decode($data); if (!is_null($media_id)) { - if (isset($data_arr->title) && + if (isset($data_arr->title) && strlen($data_arr->title) < 1024) { $previous_metadata = CcWebstreamMetadataQuery::create() @@ -989,7 +991,7 @@ class ApiController extends Zend_Controller_Action $streams = array("s1", "s2", "s3"); $stream_params = array(); foreach ($streams as $s) { - $stream_params[$s] = + $stream_params[$s] = Application_Model_StreamSetting::getStreamDataNormalized($s); } $this->view->stream_params = $stream_params; @@ -1002,5 +1004,14 @@ class ApiController extends Zend_Controller_Action Application_Model_ListenerStat::insertDataPoints($data); $this->view->data = $data; } + + public function updateStreamSettingTableAction() { + $request = $this->getRequest(); + $data = json_decode($request->getParam("data"), true); + + foreach ($data as $k=>$v) { + Application_Model_StreamSetting::SetListenerStatError($k, $v); + } + } } diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php index 3718a86a0..36069a33d 100644 --- a/airtime_mvc/application/controllers/AudiopreviewController.php +++ b/airtime_mvc/application/controllers/AudiopreviewController.php @@ -19,31 +19,30 @@ class AudiopreviewController extends Zend_Controller_Action */ public function audioPreviewAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $audioFileID = $this->_getParam('audioFileID'); $audioFileArtist = $this->_getParam('audioFileArtist'); $audioFileTitle = $this->_getParam('audioFileTitle'); $type = $this->_getParam('type'); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); $this->view->headScript()->appendFile( - $baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'], + $baseUrl.'js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile( - $baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'], + $baseUrl.'js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headLink()->appendStylesheet( - $baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); + $baseUrl.'js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); $this->_helper->layout->setLayout('audioPlayer'); $logo = Application_Model_Preference::GetStationLogo(); if ($logo) { $this->view->logo = "data:image/png;base64,$logo"; } else { - $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; + $this->view->logo = $baseUrl."css/images/airtime_logo_jp.png"; } if ($type == "audioclip") { @@ -74,24 +73,23 @@ class AudiopreviewController extends Zend_Controller_Action */ public function playlistPreviewAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $playlistIndex = $this->_getParam('playlistIndex'); $playlistID = $this->_getParam('playlistID'); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headLink()->appendStylesheet($baseUrl.'js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); $this->_helper->layout->setLayout('audioPlayer'); $logo = Application_Model_Preference::GetStationLogo(); if ($logo) { $this->view->logo = "data:image/png;base64,$logo"; } else { - $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; + $this->view->logo = $baseUrl."css/images/airtime_logo_jp.png"; } $this->view->playlistIndex= $playlistIndex; $this->view->playlistID = $playlistID; @@ -101,24 +99,23 @@ class AudiopreviewController extends Zend_Controller_Action public function blockPreviewAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $blockIndex = $this->_getParam('blockIndex'); $blockId = $this->_getParam('blockId'); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headLink()->appendStylesheet($baseUrl.'js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); $this->_helper->layout->setLayout('audioPlayer'); $logo = Application_Model_Preference::GetStationLogo(); if ($logo) { $this->view->logo = "data:image/png;base64,$logo"; } else { - $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; + $this->view->logo = $baseUrl."css/images/airtime_logo_jp.png"; } $this->view->blockIndex= $blockIndex; $this->view->blockId = $blockId; @@ -180,6 +177,8 @@ class AudiopreviewController extends Zend_Controller_Action private function createElementMap($track) { + $baseUrl = Application_Common_OsPath::getBaseDir(); + $elementMap = array( 'element_title' => isset($track['track_title'])?$track['track_title']:"", 'element_artist' => isset($track['artist_name'])?$track['artist_name']:"", 'element_id' => isset($track['id'])?$track['id']:"", @@ -213,7 +212,7 @@ class AudiopreviewController extends Zend_Controller_Action throw new Exception("Unknown file type: $mime"); } - $elementMap['uri'] = "/api/get-media/file/".$track['item_id']; + $elementMap['uri'] = $baseUrl."api/get-media/file/".$track['item_id']; } else { $elementMap['uri'] = $track['path']; } @@ -227,24 +226,23 @@ class AudiopreviewController extends Zend_Controller_Action */ public function showPreviewAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $showID = $this->_getParam('showID'); $showIndex = $this->_getParam('showIndex'); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headLink()->appendStylesheet($baseUrl.'js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']); $this->_helper->layout->setLayout('audioPlayer'); $logo = Application_Model_Preference::GetStationLogo(); if ($logo) { $this->view->logo = "data:image/png;base64,$logo"; } else { - $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; + $this->view->logo = $baseUrl."css/images/airtime_logo_jp.png"; } $this->view->showID = $showID; @@ -258,6 +256,7 @@ class AudiopreviewController extends Zend_Controller_Action */ public function getShowAction() { + $baseUrl = Application_Common_OsPath::getBaseDir(); // disable the view and the layout $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); @@ -298,7 +297,7 @@ class AudiopreviewController extends Zend_Controller_Action throw new Exception("Unknown file type: $mime"); } - $elementMap['uri'] = "/api/get-media/file/".$track['item_id']; + $elementMap['uri'] = $baseUrl."api/get-media/file/".$track['item_id']; } else { $elementMap['uri'] = $track['filepath']; } diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php index 9609a1ef8..80fd56000 100644 --- a/airtime_mvc/application/controllers/DashboardController.php +++ b/airtime_mvc/application/controllers/DashboardController.php @@ -33,9 +33,9 @@ class DashboardController extends Zend_Controller_Action Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data); } else { if ($source_connected) { - $this->view->error = "You don't have permission to disconnect source."; + $this->view->error = _("You don't have permission to disconnect source."); } else { - $this->view->error = "There is no source connected to this input."; + $this->view->error = _("There is no source connected to this input."); } } } @@ -79,12 +79,12 @@ class DashboardController extends Zend_Controller_Action } } else { if ($source_connected) { - $this->view->error = "You don't have permission to switch source."; + $this->view->error = _("You don't have permission to switch source."); } else { if ($sourcename == 'scheduled_play') { - $this->view->error = "You don't have permission to disconnect source."; + $this->view->error = _("You don't have permission to disconnect source."); } else { - $this->view->error = "There is no source connected to this input."; + $this->view->error = _("There is no source connected to this input."); } } } @@ -96,19 +96,18 @@ class DashboardController extends Zend_Controller_Action public function streamPlayerAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.blue.monday.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'js/jplayer/skin/jplayer.blue.monday.css?'.$CC_CONFIG['airtime_version']); $this->_helper->layout->setLayout('bare'); $logo = Application_Model_Preference::GetStationLogo(); if ($logo) { $this->view->logo = "data:image/png;base64,$logo"; } else { - $this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png"; + $this->view->logo = $baseUrl."css/images/airtime_logo_jp.png"; } } diff --git a/airtime_mvc/application/controllers/ErrorController.php b/airtime_mvc/application/controllers/ErrorController.php index 2c1aa0b87..0a4fee725 100644 --- a/airtime_mvc/application/controllers/ErrorController.php +++ b/airtime_mvc/application/controllers/ErrorController.php @@ -14,12 +14,12 @@ class ErrorController extends Zend_Controller_Action // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); - $this->view->message = 'Page not found'; + $this->view->message = _('Page not found'); break; default: // application error $this->getResponse()->setHttpResponseCode(500); - $this->view->message = 'Application error'; + $this->view->message = _('Application error'); break; } diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index a1a4edd82..68575f308 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -12,45 +12,47 @@ class LibraryController extends Zend_Controller_Action $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('contents-feed', 'json') ->addActionContext('delete', 'json') + ->addActionContext('duplicate', 'json') ->addActionContext('delete-group', 'json') ->addActionContext('context-menu', 'json') ->addActionContext('get-file-metadata', 'html') ->addActionContext('upload-file-soundcloud', 'json') ->addActionContext('get-upload-to-soundcloud-status', 'json') ->addActionContext('set-num-entries', 'json') + ->addActionContext('edit-file-md', 'json') ->initContext(); } public function indexAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/events/library_playlistbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_playlistbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']); try { @@ -90,7 +92,7 @@ class LibraryController extends Zend_Controller_Action protected function playlistNotFound($p_type) { - $this->view->error = "$p_type not found"; + $this->view->error = sprintf(_("%s not found"), $p_type); Logging::info("$p_type not found"); Application_Model_Library::changePlaylist(null, $p_type); @@ -99,7 +101,7 @@ class LibraryController extends Zend_Controller_Action protected function playlistUnknownError($e) { - $this->view->error = "Something went wrong."; + $this->view->error = _("Something went wrong."); Logging::info($e->getMessage()); } @@ -142,19 +144,21 @@ class LibraryController extends Zend_Controller_Action public function contextMenuAction() { + $baseUrl = Application_Common_OsPath::getBaseDir(); $id = $this->_getParam('id'); $type = $this->_getParam('type'); //playlist||timeline $screen = $this->_getParam('screen'); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + + $baseUrl = Application_Common_OsPath::getBaseDir(); + $menu = array(); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new Application_Model_User($userInfo->id); //Open a jPlayer window and play the audio clip. - $menu["play"] = array("name"=> "Preview", "icon" => "play", "disabled" => false); + $menu["play"] = array("name"=> _("Preview"), "icon" => "play", "disabled" => false); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); @@ -175,23 +179,23 @@ class LibraryController extends Zend_Controller_Action } if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($obj_sess->type === "playlist") { - $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy"); } elseif ($obj_sess->type === "block" && $obj->isStatic()) { - $menu["pl_add"] = array("name"=> "Add to Smart Block", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Smart Block"), "icon" => "add-playlist", "icon" => "copy"); } } } - if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) { - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete"); - $menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}"); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete"); + $menu["edit"] = array("name"=> _("Edit Metadata"), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}"); } - $url = $file->getRelativeFileUrl($baseUrl).'/download/true'; - $menu["download"] = array("name" => "Download", "icon" => "download", "url" => $url); + $url = $file->getRelativeFileUrl($baseUrl).'download/true'; + $menu["download"] = array("name" => _("Download"), "icon" => "download", "url" => $url); } elseif ($type === "playlist" || $type === "block") { if ($type === 'playlist') { $obj = new Application_Model_Playlist($id); + $menu["duplicate"] = array("name" => _("Duplicate Playlist"), "icon" => "edit", "url" => $baseUrl."library/duplicate"); } elseif ($type === 'block') { $obj = new Application_Model_Block($id); if (!$obj->isStatic()) { @@ -199,35 +203,38 @@ class LibraryController extends Zend_Controller_Action } if (($isAdminOrPM || $obj->getCreatorId() == $user->getId()) && $screen == "playlist") { if ($obj_sess->type === "playlist") { - $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy"); } } } if ($obj_sess->id !== $id && $screen == "playlist") { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { - $menu["edit"] = array("name"=> "Edit", "icon" => "edit"); + $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit"); } } + if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete"); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete"); } } elseif ($type == "stream") { - $webstream = CcWebstreamQuery::create()->findPK($id); $obj = new Application_Model_Webstream($webstream); + + $menu["play"]["mime"] = $webstream->getDbMime(); + if (isset($obj_sess->id) && $screen == "playlist") { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($obj_sess->type === "playlist") { - $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy"); } } } if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($screen == "playlist") { - $menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}"); - } - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete"); + $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}"); + } + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete"); } } @@ -238,26 +245,26 @@ class LibraryController extends Zend_Controller_Action $menu["sep1"] = "-----------"; //create a sub menu for Soundcloud actions. - $menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array()); + $menu["soundcloud"] = array("name" => _("Soundcloud"), "icon" => "soundcloud", "items" => array()); $scid = $file->getSoundCloudId(); if ($scid > 0) { $url = $file->getSoundCloudLinkToFile(); - $menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url); + $menu["soundcloud"]["items"]["view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url); } if (!is_null($scid)) { - $text = "Re-upload to SoundCloud"; + $text = _("Re-upload to SoundCloud"); } else { - $text = "Upload to SoundCloud"; + $text = _("Upload to SoundCloud"); } - $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}"); + $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $baseUrl."library/upload-file-soundcloud/id/{$id}"); } if (empty($menu)) { - $menu["noaction"] = array("name"=>"No action available"); + $menu["noaction"] = array("name"=>_("No action available")); } $this->view->items = $menu; @@ -277,7 +284,7 @@ class LibraryController extends Zend_Controller_Action $streams = array(); $message = null; - $noPermissionMsg = "You don't have permission to delete selected items."; + $noPermissionMsg = _("You don't have permission to delete selected items."); foreach ($mediaItems as $media) { @@ -326,7 +333,7 @@ class LibraryController extends Zend_Controller_Action $message = $noPermissionMsg; } catch (Exception $e) { //could throw a scheduled in future exception. - $message = "Could not delete some scheduled files."; + $message = _("Could not delete some scheduled files."); Logging::debug($e->getMessage()); } } @@ -336,11 +343,43 @@ class LibraryController extends Zend_Controller_Action $this->view->message = $message; } } + + // duplicate playlist + public function duplicateAction(){ + $params = $this->getRequest()->getParams(); + $id = $params['id']; + + $originalPl = new Application_Model_Playlist($id); + $newPl = new Application_Model_Playlist(); + + $contents = $originalPl->getContents(); + foreach ($contents as &$c) { + if ($c['type'] == '0') { + $c[1] = 'audioclip'; + } else if ($c['type'] == '2') { + $c[1] = 'block'; + } else if ($c['type'] == '1') { + $c[1] = 'stream'; + } + $c[0] = $c['item_id']; + } + $newPl->addAudioClips($contents, null, 'begining'); + + $newPl->setCreator(Application_Model_User::getCurrentUser()->getId()); + $newPl->setDescription($originalPl->getDescription()); + + list($plFadeIn, ) = $originalPl->getFadeInfo(0); + list(, $plFadeOut) = $originalPl->getFadeInfo($originalPl->getSize()-1); + + $newPl->setfades($plFadeIn, $plFadeOut); + $newPl->setName(sprintf(_("Copy of %s"), $originalPl->getName())); + } public function contentsFeedAction() { $params = $this->getRequest()->getParams(); + # terrible name for the method below. it does not only search files. $r = Application_Model_StoredFile::searchLibraryFiles($params); //TODO move this to the datatables row callback. @@ -379,14 +418,19 @@ class LibraryController extends Zend_Controller_Action if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) { return; } - + $form = new Application_Form_EditAudioMD(); + $form->startForm($file_id); $form->populate($file->getDbColMetadata()); if ($request->isPost()) { if ($form->isValid($request->getPost())) { - $formdata = $form->getValues(); + $formValues = $this->_getParam('data', null); + $formdata = array(); + foreach ($formValues as $val) { + $formdata[$val["name"]] = $val["value"]; + } $file->setDbColMetadata($formdata); $data = $file->getMetadata(); @@ -401,6 +445,7 @@ class LibraryController extends Zend_Controller_Action } $this->view->form = $form; + $this->view->dialog = $this->view->render('library/edit-file-md.phtml'); } public function getFileMetadataAction() @@ -453,10 +498,10 @@ class LibraryController extends Zend_Controller_Action $this->view->md = $md; if ($block->isStatic()) { - $this->view->blType = 'Static'; + $this->view->blType = _('Static'); $this->view->contents = $block->getContents(); } else { - $this->view->blType = 'Dynamic'; + $this->view->blType = _('Dynamic'); $this->view->contents = $block->getCriteria(); } $this->view->block = $block; diff --git a/airtime_mvc/application/controllers/ListenerstatController.php b/airtime_mvc/application/controllers/ListenerstatController.php index 648a88dfe..817f6ca11 100644 --- a/airtime_mvc/application/controllers/ListenerstatController.php +++ b/airtime_mvc/application/controllers/ListenerstatController.php @@ -12,22 +12,22 @@ class ListenerstatController extends Zend_Controller_Action public function indexAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/flot/jquery.flot.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/flot/jquery.flot.crosshair.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/listenerstat/listenerstat.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/flot/jquery.flot.crosshair.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/listenerstat/listenerstat.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $offset = date("Z") * -1; $this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds"); - $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); //default time is the last 24 hours. $now = time(); @@ -47,6 +47,18 @@ class ListenerstatController extends Zend_Controller_Action 'his_time_end' => $end->format("H:i") )); + $errorStatus = Application_Model_StreamSetting::GetAllListenerStatErrors(); + Logging::info($errorStatus); + $out = array(); + foreach ($errorStatus as $v) { + $key = explode('_listener_stat_error', $v['keyname']); + if ($v['value'] != 'OK') { + $v['value'] = _("Please make sure admin user/password is correct on System->Streams page."); + } + $out[$key[0]] = $v['value']; + } + + $this->view->errorStatus = $out; $this->view->date_form = $form; } diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php new file mode 100644 index 000000000..d689417be --- /dev/null +++ b/airtime_mvc/application/controllers/LocaleController.php @@ -0,0 +1,396 @@ +_helper->getHelper("AjaxContext"); + $ajaxContext->addActionContext("general-translation-table", "json") + ->addActionContext("datatables-translation-table", "json") + ->initContext(); + } + + public function datatablesTranslationTableAction() + { + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + header("Content-type: text/javascript"); + + $baseUrl = Application_Common_OsPath::getBaseDir(); + $locale = Application_Model_Preference::GetLocale(); + echo "var datatables_dict =" . + file_get_contents(Application_Common_OsPath::join( + $_SERVER["DOCUMENT_ROOT"], + $baseUrl, + "js/datatables/i18n/", + $locale.".txt") + ); + } + + public function generalTranslationTableAction() + { + $translations = array ( + //common/common.js + "Audio Player" => _("Audio Player"), + //dashboard/dashboard.js + "Recording:" => _("Recording:"), + "Master Stream" => _("Master Stream"), + "Live Stream" => _("Live Stream"), + "Nothing Scheduled" => _("Nothing Scheduled"), + "Current Show:" => _("Current Show:"), + "Current" => _("Current"), + //dashboard/versiontooltip.js + "You are running the latest version" => _("You are running the latest version"), + "New version available: " => _("New version available: "), + "This version will soon be obsolete." => _("This version will soon be obsolete."), + "This version is no longer supported." => _("This version is no longer supported."), + "Please upgrade to " => _("Please upgrade to "), + //library/events/library_playlistbuilder.js + "Add to current playlist" => _("Add to current playlist"), + "Add to current smart block" => _("Add to current smart block"), + "Adding 1 Item" => _("Adding 1 Item"), + "Adding %s Items" => _("Adding %s Items"), + "You can only add tracks to smart blocks." => _("You can only add tracks to smart blocks."), + "You can only add tracks, smart blocks, and webstreams to playlists." => _("You can only add tracks, smart blocks, and webstreams to playlists."), + //library/events/library_showbuilder.js + //already in library/events/library_playlistbuilder.js + "Please select a cursor position on timeline." => _("Please select a cursor position on timeline."), + //"Adding 1 Item" => _("Adding 1 Item"), + //"Adding %s Items" => _("Adding %s Items"), + //library/library.js + "Edit Metadata" => _("Edit Metadata"), + "Add to selected show" => _("Add to selected show"), + "Select" => _("Select"), + "Select this page" => _("Select this page"), + "Deselect this page" => _("Deselect this page"), + "Deselect all" => _("Deselect all"), + "Are you sure you want to delete the selected item(s)?" => _("Are you sure you want to delete the selected item(s)?"), + "Title" => _("Title"), + "Creator" => _("Creator"), + "Album" => _("Album"), + "Bit Rate" => _("Bit Rate"), + "BPM" => _("BPM"), + "Composer" => _("Composer"), + "Conductor" => _("Conductor"), + "Copyright" => _("Copyright"), + "Encoded By" => _("Encoded By"), + "Genre" => _("Genre"), + "ISRC" => _("ISRC"), + "Label" => _("Label"), + "Language" => _("Language"), + "Last Modified" => _("Last Modified"), + "Last Played" => _("Last Played"), + "Length" => _("Length"), + "Mime" => _("Mime"), + "Mood" => _("Mood"), + "Owner" => _("Owner"), + "Replay Gain" => _("Replay Gain"), + "Sample Rate" => _("Sample Rate"), + "Track Number" => _("Track Number"), + "Uploaded" => _("Uploaded"), + "Website" => _("Website"), + "Year" => _("Year"), + "Loading..." => _("Loading..."), + "All" => _("All"), + "Files" => _("Files"), + "Playlists" => _("Playlists"), + "Smart Blocks" => _("Smart Blocks"), + "Web Streams" => _("Web Streams"), + "Unknown type: " => _("Unknown type: "), + "Are you sure you want to delete the selected item?" => _("Are you sure you want to delete the selected item?"), + "Uploading in progress..." => _("Uploading in progress..."), + "Retrieving data from the server..." => _("Retrieving data from the server..."), + "The soundcloud id for this file is: " => _("The soundcloud id for this file is: "), + "There was an error while uploading to soundcloud." => _("There was an error while uploading to soundcloud."), + "Error code: " => _("Error code: "), + "Error msg: " => _("Error msg: "), + "Input must be a positive number" => _("Input must be a positive number"), + "Input must be a number" => _("Input must be a number"), + "Input must be in the format: yyyy-mm-dd" => _("Input must be in the format: yyyy-mm-dd"), + "Input must be in the format: hh:mm:ss.t" => _("Input must be in the format: hh:mm:ss.t"), + //library/plupload.js + "You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?" + => _("You are currently uploading files. %sGoing to another screen will cancel the upload process. %sAre you sure you want to leave the page?"), + //library/spl.js + "please put in a time '00:00:00 (.0)'" => _("please put in a time '00:00:00 (.0)'"), + "please put in a time in seconds '00 (.0)'" => _("please put in a time in seconds '00 (.0)'"), + "Your browser does not support playing this file type: " => _("Your browser does not support playing this file type: "), + "Dynamic block is not previewable" => _("Dynamic block is not previewable"), + "Limit to: " => _("Limit to: "), + "Playlist saved" => _("Playlist saved"), + "Playlist shuffled" => _("Playlist shuffled"), + "Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore." + => _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."), + //listenerstat/listenerstat.js + "Listener Count on %s: %s" => _("Listener Count on %s: %s"), + //nowplaying/register.js + "Remind me in 1 week" => _("Remind me in 1 week"), + "Remind me never" => _("Remind me never"), + "Yes, help Airtime" => _("Yes, help Airtime"), + "Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"), + //playlist/smart_blockbuilder.js + "A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show." + => _("A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show."), + "A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library." + => _("A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library."), + "The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block." + => _("The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."), + "Smart block shuffled" => _("Smart block shuffled"), + "Smart block generated and criteria saved" => _("Smart block generated and criteria saved"), + "Smart block saved" => _("Smart block saved"), + "Processing..." => _("Processing..."), + "Select modifier" => _("Select modifier"), + "contains" => _("contains"), + "does not contain" => _("does not contain"), + "is" => _("is"), + "is not" => _("is not"), + "starts with" => _("starts with"), + "ends with" => _("ends with"), + "is greater than" => _("is greater than"), + "is less than" => _("is less than"), + "is in the range" => _("is in the range"), + //playouthistory/historytable.js + "Title" => _("Title"), + "Creator" => _("Creator"), + "Played" => _("Played"), + "Length" => _("Length"), + "Composer" => _("Composer"), + "Copyright" => _("Copyright"), + "All" => _("All"), + "Copied %s row%s to the clipboard" => _("Copied %s row%s to the clipboard"), + "%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished." => _("%sPrint view%sPlease use your browser's print function to print this table. Press escape when finished."), + //preferences/musicdirs.js + "Choose Storage Folder" => _("Choose Storage Folder"), + "Choose Folder to Watch" => _("Choose Folder to Watch"), + "Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!" + => _("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!"), + "Manage Media Folders" => _("Manage Media Folders"), + "Are you sure you want to remove the watched folder?" => _("Are you sure you want to remove the watched folder?"), + "This path is currently not accessible." => _("This path is currently not accessible."), + //preferences/streamsetting.js + "Connected to the streaming server" => _("Connected to the streaming server"), + "The stream is disabled" => _("The stream is disabled"), + "Getting information from the server..." => _("Getting information from the server..."), + "Can not connect to the streaming server" => _("Can not connect to the streaming server"), + "If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151." + => _("If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151."), + "For more details, please read the %sAirtime Manual%s" => _("For more details, please read the %sAirtime Manual%s"), + "Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option." + => _("Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option."), + "Check this box to automatically switch off Master/Show source upon source disconnection." => _("Check this box to automatically switch off Master/Show source upon source disconnection."), + "Check this box to automatically switch on Master/Show source upon source connection." => _("Check this box to automatically switch on Master/Show source upon source connection."), + "If your Icecast server expects a username of 'source', this field can be left blank." => _("If your Icecast server expects a username of 'source', this field can be left blank."), + "If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."), + "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted." + => _("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."), + "This is the admin username and password for Icecast/SHOUTcast to get listener statistics." => _("This is the admin username and password for Icecast/SHOUTcast to get listener statistics."), + //preferences/support-setting.js + "Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"), + //schedule/add-show.js + "No result found" => _("No result found"), + "This follows the same security pattern for the shows: only users assigned to the show can connect." => _("This follows the same security pattern for the shows: only users assigned to the show can connect."), + "Specify custom authentication which will work only for this show." => _("Specify custom authentication which will work only for this show."), + "If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."), + "The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"), + //schedule/full-calendar-functions + //already in schedule/add-show.js + //"The show instance doesn't exist anymore!" => _("The show instance doesn't exist anymore!"), + "Show" => _("Show"), + "Show is empty" => _("Show is empty"), + "1m" => _("1m"), + "5m" => _("5m"), + "10m" => _("10m"), + "15m" => _("15m"), + "30m" => _("30m"), + "60m" => _("60m"), + "Uploading in progress..." => _("Uploading in progress..."), + "Retreiving data from the server..." => _("Retreiving data from the server..."), + //already in library/library.js + //"The soundcloud id for this file is: " => _("The soundcloud id for this file is: "), + //"There was error while uploading to soundcloud." => _("There was error while uploading to soundcloud."), + //"Error code: " => _("Error code: "), + //"Error msg: " => _("Error msg: "), + "This show has no scheduled content." => _("This show has no scheduled content."), + "This show is not completely filled with content." => _("This show is not completely filled with content."), + //already in schedule/add-show.js + //"The show instance doesn"t exist anymore!" => _("The show instance doesn"t exist anymore!"), + //schedule/schedule.js + "January" => _("January"), + "February" => _("February"), + "March" => _("March"), + "April" => _("April"), + "May" => _("May"), + "June" => _("June"), + "July" => _("July"), + "August" => _("August"), + "September" => _("September"), + "October" => _("October"), + "November" => _("November"), + "December" => _("December"), + "Jan" => _("Jan"), + "Feb" => _("Feb"), + "Mar" => _("Mar"), + "Apr" => _("Apr"), + "May" => _("May"), + "Jun" => _("Jun"), + "Jul" => _("Jul"), + "Aug" => _("Aug"), + "Sep" => _("Sep"), + "Oct" => _("Oct"), + "Nov" => _("Nov"), + "Dec" => _("Dec"), + "today" => _("today"), + "day" => _("day"), + "week" => _("week"), + "month" => _("month"), + "Sunday" => _("Sunday"), + "Monday" => _("Monday"), + "Tuesday" => _("Tuesday"), + "Wednesday" => _("Wednesday"), + "Thursday" => _("Thursday"), + "Friday" => _("Friday"), + "Saturday" => _("Saturday"), + "Sun" => _("Sun"), + "Mon" => _("Mon"), + "Tue" => _("Tue"), + "Wed" => _("Wed"), + "Thu" => _("Thu"), + "Fri" => _("Fri"), + "Sat" => _("Sat"), + "Shows longer than their scheduled time will be cut off by a following show." => _("Shows longer than their scheduled time will be cut off by a following show."), + "Cancel Current Show?" => _("Cancel Current Show?"), + "Stop recording current show?" => _("Stop recording current show?"), + "Ok" => _("Ok"), + "Contents of Show" => _("Contents of Show"), + //already in schedule/add-show.js + //"The show instance doesn"t exist anymore!" => _("The show instance doesn"t exist anymore!"), + "Remove all content?" => _("Remove all content?"), + //showbuilder/builder.js + "Delete selected item(s)?" => _("Delete selected item(s)?"), + "Start" => _("Start"), + "End" => _("End"), + "Duration" => _("Duration"), + //already in library/library.js + //"Title" => _("Title"), + //"Creator" => _("Creator"), + //"Album" => _("Album"), + //"Mime" => _("Mime"), + "Cue In" => _("Cue In"), + "Cue Out" => _("Cue Out"), + "Fade In" => _("Fade In"), + "Fade Out" => _("Fade Out"), + "Show Empty" => _("Show Empty"), + "Recording From Line In" => _("Recording From Line In"), + "Track preview" => _("Track preview"), + //already in library/spl.js + //"Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn"t "watched" anymore." + //=> _("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn"t "watched" anymore."), + "Cannot schedule outside a show." => _("Cannot schedule outside a show."), + "Moving 1 Item" => _("Moving 1 Item"), + "Moving %s Items" => _("Moving %s Items"), + //already in library/library.js + //"Select" => _("Select"), + "Select all" => _("Select all"), + "Select none" => _("Select none"), + "Remove overbooked tracks" => _("Remove overbooked tracks"), + "Remove selected scheduled items" => _("Remove selected scheduled items"), + "Jump to the current playing track" => _("Jump to the current playing track"), + "Cancel current show" => _("Cancel current show"), + //already in schedule/schedule.js + //"Cancel Current Show?" => _("Cancel Current Show?"), + "Stop recording current show?" => _("Stop recording current show?"), + //showbuilder/main_builder.js + "Open library to add or remove content" => _("Open library to add or remove content"), + "Add / Remove Content" => _("Add / Remove Content"), + //status/status.js + "in use" => _("in use"), + "Disk" => _("Disk"), + //serverbrowse/serverbrowse.js + "Look in" => _("Look in"), + "Cancel" => _("Cancel"), + "Open" => _("Open"), + //user/user.js + "Admin" => _("Admin"), + "DJ" => _("DJ"), + "Program Manager" => _("Program Manager"), + "Guest" => _("Guest"), + "Guests can do the following:" => _("Guests can do the following:"), + "View schedule" => _("View schedule"), + "View show content" => _("View show content"), + "DJs can do the following:" => _("DJs can do the following:"), + "Manage assigned show content" => _("Manage assigned show content"), + "Import media files" => _("Import media files"), + "Create playlists, smart blocks, and webstreams" => _("Create playlists, smart blocks, and webstreams"), + "Manage their own library content" => _("Manage their own library content"), + "Progam Managers can do the following:" => _("Progam Managers can do the following:"), + "View and manage show content" => _("View and manage show content"), + "Schedule shows" => _("Schedule shows"), + "Manage all library content" => _("Manage all library content"), + "Admins can do the following:" => _("Admins can do the following:"), + "Manage preferences" => _("Manage preferences"), + "Manage users" => _("Manage users"), + "Manage watched folders" => _("Manage watched folders"), + "Send support feedback" => _("Send support feedback"), + "View system status" => _("View system status"), + "Access playout history" => _("Access playout history"), + "View listener stats" => _("View listener stats"), + //dataTables/ColVis.js + "Show / hide columns" => _("Show / hide columns"), + //datatables.columnFilter.js + "From {from} to {to}" => _("From {from} to {to}"), + "kbps" => _("kbps"), + "yyyy-mm-dd" => _("yyyy-mm-dd"), + "hh:mm:ss.t" => _("hh:mm:ss.t"), + "kHz" => _("kHz"), + //datepicker + //months are already in schedule/schedule.js + "Su" => _("Su"), + "Mo" => _("Mo"), + "Tu" => _("Tu"), + "We" => _("We"), + "Th" => _("Th"), + "Fr" => _("Fr"), + "Sa" => _("Sa"), + "Close" => _("Close"), + //timepicker + "Hour" => _("Hour"), + "Minute" => _("Minute"), + "Done" => _("Done"), + //plupload ships with translation files but a lot are incomplete + //so we will keep them here to prevent incomplete translations + "Select files" => _("Select files"), + "Add files to the upload queue and click the start button." => _("Add files to the upload queue and click the start button."), + "Filename" => _("Add files to the upload queue and click the start button."), + "Status" => _("Status"), + "Size" => _("Status"), + "Add Files" => _("Add Files"), + "Stop Upload" => _("Stop Upload"), + "Start upload" => _("Start upload"), + "Add files" => _("Add files"), + "Uploaded %d/%d files"=> _("Uploaded %d/%d files"), + "N/A" => _("N/A"), + "Drag files here." => _("Drag files here."), + "File extension error." => _("File extension error."), + "File size error." => _("File size error."), + "File count error." => _("File count error."), + "Init error." => _("Init error."), + "HTTP Error." => _("HTTP Error."), + "Security error." => _("Security error."), + "Generic error." => _("Generic error."), + "IO error." => _("IO error."), + "File: %s" => _("File: %s"), + "Close" => _("Close"), + "%d files queued" => _("%d files queued"), + "File: %f, size: %s, max file size: %m" => _("File: %f, size: %s, max file size: %m"), + "Upload URL might be wrong or doesn't exist" => _("Upload URL might be wrong or doesn't exist"), + "Error: File too large: " => _("Error: File too large: "), + "Error: Invalid file extension: " => _("Error: Invalid file extension: ") + + ); + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + header("Content-type: text/javascript"); + echo "var general_dict=".json_encode($translations); + + } +} diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index e3eeccca4..c95a12f0a 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -5,14 +5,18 @@ class LoginController extends Zend_Controller_Action public function init() { - /* Initialize action controller here */ } public function indexAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); + + $request = $this->getRequest(); + + Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA')); + if (Zend_Auth::getInstance()->hasIdentity()) + { - if (Zend_Auth::getInstance()->hasIdentity()) { $this->_redirect('Showbuilder'); } @@ -20,14 +24,14 @@ class LoginController extends Zend_Controller_Action $this->_helper->layout->setLayout('login'); $error = false; - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $form = new Application_Form_Login(); - $message = "Please enter your user name and password"; + $message = _("Please enter your user name and password"); if ($request->isPost()) { // if the post contains recaptcha field, which means form had recaptcha field. @@ -39,6 +43,7 @@ class LoginController extends Zend_Controller_Action //get the username and password from the form $username = $form->getValue('username'); $password = $form->getValue('password'); + $locale = $form->getValue('locale'); if (Application_Model_Subjects::getLoginAttempts($username) >= 3 && $form->getElement('captcha') == NULL) { $form->addRecaptcha(); } else { @@ -63,10 +68,13 @@ class LoginController extends Zend_Controller_Action $tempSess = new Zend_Session_Namespace("referrer"); $tempSess->referrer = 'login'; + + //set the user locale in case user changed it in when logging in + Application_Model_Preference::SetUserLocale($auth->getIdentity()->id, $locale); $this->_redirect('Showbuilder'); } else { - $message = "Wrong username or password provided. Please try again."; + $message = _("Wrong username or password provided. Please try again."); Application_Model_Subjects::increaseLoginAttempts($username); Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']); $form = new Application_Form_Login(); @@ -94,11 +102,11 @@ class LoginController extends Zend_Controller_Action public function passwordRestoreAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $baseUrl = Application_Common_OsPath::getBaseDir(); + + $this->view->headScript()->appendFile($baseUrl.'js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); if (!Application_Model_Preference::GetEnableSystemEmail()) { $this->_redirect('login'); @@ -128,10 +136,10 @@ class LoginController extends Zend_Controller_Action if ($success) { $this->_helper->redirector('password-restore-after', 'login'); } else { - $form->email->addError($this->view->translate("Email could not be sent. Check your mail server settings and ensure it has been configured properly.")); + $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); } } else { - $form->email->addError($this->view->translate("Given email not found.")); + $form->email->addError($this->view->translate(_("Given email not found."))); } } diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 0d2ead443..19c2756e7 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -25,6 +25,7 @@ class PlaylistController extends Zend_Controller_Action ->addActionContext('smart-block-generate', 'json') ->addActionContext('smart-block-shuffle', 'json') ->addActionContext('get-block-info', 'json') + ->addActionContext('shuffle', 'json') ->initContext(); } @@ -41,7 +42,7 @@ class PlaylistController extends Zend_Controller_Action $modified = $this->_getParam('modified', null); if ($obj->getLastModified("U") !== $modified) { $this->createFullResponse($obj); - throw new PlaylistOutDatedException("You are viewing an older version of {$obj->getName()}"); + throw new PlaylistOutDatedException(sprintf(_("You are viewing an older version of %s"), $obj->getName())); } } @@ -72,7 +73,6 @@ class PlaylistController extends Zend_Controller_Action $isBlock = true; $viewPath = 'playlist/smart-block.phtml'; } - if (isset($obj)) { $formatter = new LengthFormatter($obj->getLength()); $this->view->length = $formatter->format(); @@ -94,7 +94,11 @@ class PlaylistController extends Zend_Controller_Action } else { $this->view->obj = $obj; $this->view->id = $obj->getId(); - $this->view->html = $this->view->render($viewPath); + if ($isJson) { + return $this->view->html = $this->view->render($viewPath); + } else { + $this->view->html = $this->view->render($viewPath); + } unset($this->view->obj); } } else { @@ -113,14 +117,14 @@ class PlaylistController extends Zend_Controller_Action private function blockDynamic($obj) { - $this->view->error = "You cannot add tracks to dynamic blocks."; + $this->view->error = _("You cannot add tracks to dynamic blocks."); $this->createFullResponse($obj); } private function playlistNotFound($p_type, $p_isJson = false) { $p_type = ucfirst($p_type); - $this->view->error = "{$p_type} not found"; + $this->view->error = sprintf(_("%s not found"), $p_type); Logging::info("{$p_type} not found"); Application_Model_Library::changePlaylist(null, $p_type); @@ -134,26 +138,26 @@ class PlaylistController extends Zend_Controller_Action private function playlistNoPermission($p_type) { - $this->view->error = "You don't have permission to delete selected {$p_type}(s)."; + $this->view->error = sprintf(_("You don't have permission to delete selected %s(s)."), $p_type); $this->changePlaylist(null, $p_type); $this->createFullResponse(null); } private function playlistUnknownError($e) { - $this->view->error = "Something went wrong."; + $this->view->error = _("Something went wrong."); Logging::info($e->getMessage()); } private function wrongTypeToBlock($obj) { - $this->view->error = "You can only add tracks to smart block."; + $this->view->error = _("You can only add tracks to smart block."); $this->createFullResponse($obj); } private function wrongTypeToPlaylist($obj) { - $this->view->error = "You can only add tracks, smart blocks, and webstreams to playlists."; + $this->view->error = _("You can only add tracks, smart blocks, and webstreams to playlists."); $this->createFullResponse($obj); } @@ -165,9 +169,9 @@ class PlaylistController extends Zend_Controller_Action $objInfo = Application_Model_Library::getObjInfo($type); - $name = 'Untitled Playlist'; + $name = _('Untitled Playlist'); if ($type == 'block') { - $name = 'Untitled Smart Block'; + $name = _('Untitled Smart Block'); } $obj = new $objInfo['className'](); @@ -430,7 +434,7 @@ class PlaylistController extends Zend_Controller_Action public function setPlaylistNameDescAction() { - $name = $this->_getParam('name', 'Unknown Playlist'); + $name = $this->_getParam('name', _('Unknown Playlist')); $description = $this->_getParam('description', ""); $type = $this->_getParam('type'); @@ -537,6 +541,26 @@ class PlaylistController extends Zend_Controller_Action $this->playlistUnknownError($e); } } + + public function shuffleAction() + { + $request = $this->getRequest(); + $params = $request->getPost(); + try { + $pl = new Application_Model_Playlist($params['obj_id']); + $result = $pl->shuffle(); + + if ($result['result'] == 0) { + die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($pl, true)))); + } else { + die(json_encode($result)); + } + } catch (PlaylistNotFoundException $e) { + $this->playlistNotFound('block', true); + } catch (Exception $e) { + $this->playlistUnknownError($e); + } + } public function getBlockInfoAction() { diff --git a/airtime_mvc/application/controllers/PlayouthistoryController.php b/airtime_mvc/application/controllers/PlayouthistoryController.php index 7a046da9b..3269fcd46 100644 --- a/airtime_mvc/application/controllers/PlayouthistoryController.php +++ b/airtime_mvc/application/controllers/PlayouthistoryController.php @@ -8,14 +8,15 @@ class PlayouthistoryController extends Zend_Controller_Action $ajaxContext ->addActionContext('playout-history-feed', 'json') ->initContext(); - } + } public function indexAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + + $baseUrl = Application_Common_OsPath::getBaseDir(); //default time is the last 24 hours. $now = time(); @@ -37,23 +38,23 @@ class PlayouthistoryController extends Zend_Controller_Action $this->view->date_form = $form; - $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/ZeroClipboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/TableTools/js/TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $offset = date("Z") * -1; $this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds"); - $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/playouthistory/historytable.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/playouthistory.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'js/datatables/plugin/TableTools/css/TableTools.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/playouthistory.css?'.$CC_CONFIG['airtime_version']); } public function playoutHistoryFeedAction() @@ -81,4 +82,5 @@ class PlayouthistoryController extends Zend_Controller_Action $this->view->iTotalRecords = $r["iTotalRecords"]; $this->view->history = $r["history"]; } + } diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index 271cda4e9..ed7403693 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -13,16 +13,17 @@ class PluploadController extends Zend_Controller_Action public function indexAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); + $locale = Application_Model_Preference::GetLocale(); - $this->view->headScript()->appendFile($baseUrl.'/js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/plupload/i18n/'.$locale.'.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/plupload.queue.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/plupload.queue.css?'.$CC_CONFIG['airtime_version']); } public function uploadAction() diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 6450626e5..68a908e8e 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -20,36 +20,50 @@ class PreferenceController extends Zend_Controller_Action public function indexAction() { - global $CC_CONFIG; - + $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + + $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; + + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->statusMsg = ""; $form = new Application_Form_Preferences(); if ($request->isPost()) { - if ($form->isValid($request->getPost())) { - $values = $form->getValues(); + $params = $request->getPost(); + $postData = explode('&', $params['data']); + foreach($postData as $k=>$v) { + $v = explode('=', $v); + $values[$v[0]] = urldecode($v[1]); + } + if ($form->isValid($values)) { - Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view); - Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]); - Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]); - Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]); - Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]); + Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); + Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]); + Application_Model_Preference::SetAllow3rdPartyApi($values["thirdPartyApi"]); + Application_Model_Preference::SetDefaultLocale($values["locale"]); + Application_Model_Preference::SetDefaultTimezone($values["timezone"]); + Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]); - Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]); - Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]); - Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]); - Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]); - Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]); - Application_Model_Preference::SetSoundCloudGenre($values["preferences_soundcloud"]["SoundCloudGenre"]); - Application_Model_Preference::SetSoundCloudTrackType($values["preferences_soundcloud"]["SoundCloudTrackType"]); - Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]); + Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["UseSoundCloud"]); + Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]); + Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]); + Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]); + Application_Model_Preference::SetSoundCloudPassword($values["SoundCloudPassword"]); + Application_Model_Preference::SetSoundCloudTags($values["SoundCloudTags"]); + Application_Model_Preference::SetSoundCloudGenre($values["SoundCloudGenre"]); + Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]); + Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]); - $this->view->statusMsg = "
Preferences updated.
"; + $this->view->statusMsg = "
". _("Preferences updated.")."
"; + $this->view->form = $form; + die(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml')))); + } else { + $this->view->form = $form; + die(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml')))); } } $this->view->form = $form; @@ -57,19 +71,25 @@ class PreferenceController extends Zend_Controller_Action public function supportSettingAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $baseUrl = Application_Common_OsPath::getBaseDir(); + + $this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->statusMsg = ""; - $form = new Application_Form_SupportSettings(); if ($request->isPost()) { $values = $request->getPost(); - if ($form->isValid($values)) { + if ($values["Publicise"] != 1) { + Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); + Application_Model_Preference::SetPublicise($values["Publicise"]); + if (isset($values["Privacy"])) { + Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); + } + } else if ($form->isValid($values)) { Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view); Application_Model_Preference::SetPhone($values["Phone"]); Application_Model_Preference::SetEmail($values["Email"]); @@ -85,9 +105,10 @@ class PreferenceController extends Zend_Controller_Action if (isset($values["Privacy"])) { Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); } - $this->view->statusMsg = "
Support setting updated.
"; } + $this->view->statusMsg = "
"._("Support setting updated.")."
"; } + $logo = Application_Model_Preference::GetStationLogo(); if ($logo) { $this->view->logoImg = $logo; @@ -97,21 +118,20 @@ class PreferenceController extends Zend_Controller_Action $privacyChecked = true; } $this->view->privacyChecked = $privacyChecked; - $this->view->section_title = 'Support Feedback'; + $this->view->section_title = _('Support Feedback'); $this->view->form = $form; - //$form->render($this->view); } public function directoryConfigAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); - if (Application_Model_Preference::GetPlanLevel() == 'disabled') { - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ + + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/serverbrowse/serverbrowser.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/musicdirs.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $watched_dirs_pref = new Application_Form_WatchedDirPreferences(); @@ -121,12 +141,13 @@ class PreferenceController extends Zend_Controller_Action public function streamSettingAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $baseUrl = Application_Common_OsPath::getBaseDir(); + + $this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); // get current settings $temp = Application_Model_StreamSetting::getStreamSetting(); @@ -174,10 +195,37 @@ class PreferenceController extends Zend_Controller_Action $form->addSubForm($subform, "s".$i."_subform"); } if ($request->isPost()) { - $values = $request->getPost(); + $params = $request->getPost(); + /* Parse through post data and put in format + * $form->isValid() is expecting it in + */ + $postData = explode('&', $params['data']); + $s1_data = array(); + $s2_data = array(); + $s3_data = array(); + foreach($postData as $k=>$v) { + $v = explode('=', urldecode($v)); + if (strpos($v[0], "s1_data") !== false) { + /* In this case $v[0] may be 's1_data[enable]' , for example. + * We only want the 'enable' part + */ + preg_match('/\[(.*)\]/', $v[0], $matches); + $s1_data[$matches[1]] = $v[1]; + } elseif (strpos($v[0], "s2_data") !== false) { + preg_match('/\[(.*)\]/', $v[0], $matches); + $s2_data[$matches[1]] = $v[1]; + } elseif (strpos($v[0], "s3_data") !== false) { + preg_match('/\[(.*)\]/', $v[0], $matches); + $s3_data[$matches[1]] = $v[1]; + } else { + $values[$v[0]] = $v[1]; + } + } + $values["s1_data"] = $s1_data; + $values["s2_data"] = $s2_data; + $values["s3_data"] = $s3_data; $error = false; - if ($form->isValid($values)) { $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); @@ -192,6 +240,17 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]); Application_Model_Preference::SetAutoTransition($values["auto_transition"]); Application_Model_Preference::SetAutoSwitch($values["auto_switch"]); + + // compare new values with current value + $changeRGenabled = Application_Model_Preference::GetEnableReplayGain() != $values["enableReplayGain"]; + $changeRGmodifier = Application_Model_Preference::getReplayGainModifier() != $values["replayGainModifier"]; + if ($changeRGenabled || $changeRGmodifier) { + $md = array('schedule' => Application_Model_Schedule::getSchedule()); + Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md); + } + + Application_Model_Preference::SetEnableReplayGain($values["enableReplayGain"]); + Application_Model_Preference::setReplayGainModifier($values["replayGainModifier"]); // store stream update timestamp Application_Model_Preference::SetStreamUpdateTimestamp(); @@ -204,12 +263,23 @@ class PreferenceController extends Zend_Controller_Action } Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data); - $this->view->statusMsg = "
Stream Setting Updated.
"; + + $live_stream_subform->updateVariables(); + $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); + $this->view->form = $form; + $this->view->num_stream = $num_of_stream; + $this->view->statusMsg = "
"._("Stream Setting Updated.")."
"; + die(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/stream-setting.phtml')))); + } else { + $live_stream_subform->updateVariables(); + $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); + $this->view->form = $form; + $this->view->num_stream = $num_of_stream; + die(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/stream-setting.phtml')))); } } $live_stream_subform->updateVariables(); - $this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."; $this->view->num_stream = $num_of_stream; $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); @@ -225,7 +295,7 @@ class PreferenceController extends Zend_Controller_Action if (is_null($path)) { $element = array(); - $element["name"] = "path should be specified"; + $element["name"] = _("path should be specified"); $element["isFolder"] = false; $element["isError"] = true; $result[$path] = $element; @@ -284,13 +354,14 @@ class PreferenceController extends Zend_Controller_Action public function rescanWatchDirectoryAction() { - $dir = Application_Model_MusicDir::getDirByPath($this->getRequest()->getParam("dir")); - $id = $dir->getId(); - $data = array(); - $data['directory'] = $dir->getDirectory(); - $data['id'] = $id; + $dir_path = $this->getRequest()->getParam('dir'); + $dir = Application_Model_MusicDir::getDirByPath($dir_path); + $data = array( 'directory' => $dir->getDirectory(), + 'id' => $dir->getId()); Application_Model_RabbitMq::SendMessageToMediaMonitor('rescan_watch', $data); - die(); + Logging::info("Unhiding all files belonging to:: $dir_path"); + $dir->unhideFiles(); + die(); # Get rid of this ugliness later } public function removeWatchDirectoryAction() @@ -319,7 +390,7 @@ class PreferenceController extends Zend_Controller_Action $num_of_stream = intval(Application_Model_Preference::GetNumOfStreams()); for ($i=1; $i<=$num_of_stream; $i++) { $status = Application_Model_StreamSetting::getLiquidsoapError($i); - $status = $status == NULL?"Problem with Liquidsoap...":$status; + $status = $status == NULL?_("Problem with Liquidsoap..."):$status; if (!Application_Model_StreamSetting::getStreamEnabled($i)) { $status = "N/A"; } diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 73fc2d3fa..3826cce50 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -40,53 +40,52 @@ class ScheduleController extends Zend_Controller_Action public function indexAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); //full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time $this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds"); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/schedule/full-calendar-functions.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/fullcalendar/fullcalendar.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/colorpicker/js/colorpicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/schedule/add-show.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/schedule/schedule.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/fullcalendar.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/colorpicker/css/colorpicker.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/add-show.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); //Start Show builder JS/CSS requirements - $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/TableTools.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']); //End Show builder JS/CSS requirements Application_Model_Schedule::createNewFormSections($this->view); @@ -227,6 +226,7 @@ class ScheduleController extends Zend_Controller_Action $id = $this->_getParam('id'); $menu = array(); $epochNow = time(); + $baseUrl = Application_Common_OsPath::getBaseDir(); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new Application_Model_User($userInfo->id); @@ -249,8 +249,8 @@ class ScheduleController extends Zend_Controller_Action $file = $instance->getRecordedFile(); $fileId = $file->getId(); - $menu["view_recorded"] = array("name" => "View Recorded File Metadata", "icon" => "overview", - "url" => "/library/edit-file-md/id/".$fileId); + $menu["view_recorded"] = array("name" => _("View Recorded File Metadata"), "icon" => "overview", + "url" => $baseUrl."library/edit-file-md/id/".$fileId); } if ($epochNow < $showStartLocalDT->getTimestamp()) { @@ -258,17 +258,17 @@ class ScheduleController extends Zend_Controller_Action && !$instance->isRecorded() && !$instance->isRebroadcast()) { - $menu["schedule"] = array("name"=> "Add / Remove Content", "icon" => "add-remove-content", - "url" => "/showbuilder/builder-dialog/"); + $menu["schedule"] = array("name"=> _("Add / Remove Content"), "icon" => "add-remove-content", + "url" => $baseUrl."showbuilder/builder-dialog/"); - $menu["clear"] = array("name"=> "Remove All Content", "icon" => "remove-all-content", - "url" => "/schedule/clear-show"); + $menu["clear"] = array("name"=> _("Remove All Content"), "icon" => "remove-all-content", + "url" => $baseUrl."schedule/clear-show"); } } if (!$instance->isRecorded()) { - $menu["content"] = array("name"=> "Show Content", "icon" => "overview", "url" => "/schedule/show-content-dialog"); + $menu["content"] = array("name"=> _("Show Content"), "icon" => "overview", "url" => $baseUrl."schedule/show-content-dialog"); } if ($showEndLocalDT->getTimestamp() <= $epochNow @@ -281,10 +281,10 @@ class ScheduleController extends Zend_Controller_Action if ($scid > 0) { $url = $file->getSoundCloudLinkToFile(); - $menu["soundcloud_view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url); + $menu["soundcloud_view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url); } - $text = is_null($scid) ? 'Upload to SoundCloud' : 'Re-upload to SoundCloud'; + $text = is_null($scid) ? _('Upload to SoundCloud') : _('Re-upload to SoundCloud'); $menu["soundcloud_upload"] = array("name"=> $text, "icon" => "soundcloud"); } @@ -292,34 +292,34 @@ class ScheduleController extends Zend_Controller_Action $epochNow < $showEndLocalDT->getTimestamp() && $isAdminOrPM) { if ($instance->isRecorded()) { - $menu["cancel_recorded"] = array("name"=> "Cancel Current Show", "icon" => "delete"); + $menu["cancel_recorded"] = array("name"=> _("Cancel Current Show"), "icon" => "delete"); } else { if (!$instance->isRebroadcast()) { - $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form"); + $menu["edit"] = array("name"=> _("Edit Show"), "icon" => "edit", "_type"=>"all", "url" => $baseUrl."Schedule/populate-show-form"); } - $menu["cancel"] = array("name"=> "Cancel Current Show", "icon" => "delete"); + $menu["cancel"] = array("name"=> _("Cancel Current Show"), "icon" => "delete"); } } if ($epochNow < $showStartLocalDT->getTimestamp()) { if (!$instance->isRebroadcast() && $isAdminOrPM) { - $menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form"); + $menu["edit"] = array("name"=> _("Edit Show"), "icon" => "edit", "_type"=>"all", "url" => $baseUrl."Schedule/populate-show-form"); } if ($instance->getShow()->isRepeating() && $isAdminOrPM) { //create delete sub menu. - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "items" => array()); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "items" => array()); - $menu["del"]["items"]["single"] = array("name"=> "Delete This Instance", "icon" => "delete", "url" => "/schedule/delete-show"); + $menu["del"]["items"]["single"] = array("name"=> _("Delete This Instance"), "icon" => "delete", "url" => $baseUrl."schedule/delete-show"); - $menu["del"]["items"]["following"] = array("name"=> "Delete This Instance and All Following", "icon" => "delete", "url" => "/schedule/cancel-show"); + $menu["del"]["items"]["following"] = array("name"=> _("Delete This Instance and All Following"), "icon" => "delete", "url" => $baseUrl."schedule/cancel-show"); } elseif ($isAdminOrPM) { - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/schedule/delete-show"); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."schedule/delete-show"); } } @@ -442,8 +442,10 @@ class ScheduleController extends Zend_Controller_Action $originalDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); //$timestamp = Application_Common_DateHelper::ConvertToLocalDateTimeString($originalDateTime->format("Y-m-d H:i:s")); $this->view->additionalShowInfo = - "Rebroadcast of show \"$originalShowName\" from " - .$originalDateTime->format("l, F jS")." at ".$originalDateTime->format("G:i"); + sprintf(_("Rebroadcast of show %s from %s at %s"), + $originalShowName, + $originalDateTime->format("l, F jS"), + $originalDateTime->format("G:i")); } $this->view->showLength = $show->getShowLength(); $this->view->timeFilled = $show->getTimeScheduled(); @@ -833,8 +835,6 @@ class ScheduleController extends Zend_Controller_Action public function contentContextMenuAction() { - global $CC_CONFIG; - $id = $this->_getParam('id'); $params = '/format/json/id/#id#/'; @@ -848,9 +848,9 @@ class ScheduleController extends Zend_Controller_Action $file = Application_Model_StoredFile::Recall($file_id); $baseUrl = $this->getRequest()->getBaseUrl(); - $url = $file->getRelativeFileUrl($baseUrl).'/download/true'; + $url = $file->getRelativeFileUrl($baseUrl).'download/true'; $menu[] = array('action' => array('type' => 'gourl', 'url' => $url), - 'title' => 'Download'); + 'title' => _('Download')); //returns format jjmenu is looking for. die(json_encode($menu)); @@ -876,8 +876,6 @@ class ScheduleController extends Zend_Controller_Action public function calculateDurationAction() { - global $CC_CONFIG; - $startParam = $this->_getParam('startTime'); $endParam = $this->_getParam('endTime'); diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index a31119cdb..2c4fd4b16 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -18,12 +18,14 @@ class ShowbuilderController extends Zend_Controller_Action public function indexAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); + $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); - $user = Application_Model_User::getCurrentUser(); - + + $baseUrl = Application_Common_OsPath::getBaseDir(); + + $user = Application_Model_User::GetCurrentUser(); $userType = $user->getType(); $this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );"); @@ -42,28 +44,27 @@ class ShowbuilderController extends Zend_Controller_Action } else { $this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );"); } - - $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript'); + $this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $refer_sses = new Zend_Session_Namespace('referrer'); if ($request->isPost()) { @@ -105,7 +106,7 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->logoImg = $logo; } $this->view->dialog = $form; - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); } } @@ -120,7 +121,7 @@ class ShowbuilderController extends Zend_Controller_Action $this->view->logoImg = $logo; } $this->view->dialog = $form; - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); } //determine whether to remove/hide/display the library. @@ -163,16 +164,18 @@ class ShowbuilderController extends Zend_Controller_Action $offset = date("Z") * -1; $this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //in seconds"); - $this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); - $this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']); } public function contextMenuAction() { + $baseUrl = Application_Common_OsPath::getBaseDir(); + $id = $this->_getParam('id'); $now = floatval(microtime(true)); @@ -184,15 +187,15 @@ class ShowbuilderController extends Zend_Controller_Action $item = CcScheduleQuery::create()->findPK($id); $instance = $item->getCcShowInstances(); - $menu["preview"] = array("name"=> "Preview", "icon" => "play"); + $menu["preview"] = array("name"=> _("Preview"), "icon" => "play"); //select the cursor - $menu["selCurs"] = array("name"=> "Select cursor","icon" => "select-cursor"); - $menu["delCurs"] = array("name"=> "Remove cursor","icon" => "select-cursor"); + $menu["selCurs"] = array("name"=> _("Select cursor"),"icon" => "select-cursor"); + $menu["delCurs"] = array("name"=> _("Remove cursor"),"icon" => "select-cursor"); if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) { //remove/truncate the item from the schedule - $menu["del"] = array("name"=> "Remove from show", "icon" => "delete", "url" => "/showbuilder/schedule-remove"); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."showbuilder/schedule-remove"); } $this->view->items = $menu; @@ -206,7 +209,7 @@ class ShowbuilderController extends Zend_Controller_Action $instance = CcShowInstancesQuery::create()->findPK($id); if (is_null($instance)) { - $this->view->error = "show does not exist"; + $this->view->error = _("show does not exist"); return; } diff --git a/airtime_mvc/application/controllers/SystemstatusController.php b/airtime_mvc/application/controllers/SystemstatusController.php index 32ed64c22..2ff30a556 100644 --- a/airtime_mvc/application/controllers/SystemstatusController.php +++ b/airtime_mvc/application/controllers/SystemstatusController.php @@ -4,12 +4,11 @@ class SystemstatusController extends Zend_Controller_Action { public function init() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); - $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); - $this->view->headScript()->appendFile($baseUrl.'/js/airtime/status/status.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); + $this->view->headScript()->appendFile($baseUrl.'js/airtime/status/status.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); } public function indexAction() diff --git a/airtime_mvc/application/controllers/UserController.php b/airtime_mvc/application/controllers/UserController.php index 9c09ceecb..395156f97 100644 --- a/airtime_mvc/application/controllers/UserController.php +++ b/airtime_mvc/application/controllers/UserController.php @@ -10,20 +10,21 @@ class UserController extends Zend_Controller_Action ->addActionContext('get-user-data-table-info', 'json') ->addActionContext('get-user-data', 'json') ->addActionContext('remove-user', 'json') + ->addActionContext('edit-user', 'json') ->initContext(); } public function addUserAction() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); - $baseUrl = $request->getBaseUrl(); + $baseUrl = Application_Common_OsPath::getBaseDir(); $js_files = array( - '/js/datatables/js/jquery.dataTables.js?', - '/js/datatables/plugin/dataTables.pluginAPI.js?', - '/js/airtime/user/user.js?' + 'js/datatables/js/jquery.dataTables.js?', + 'js/datatables/plugin/dataTables.pluginAPI.js?', + 'js/airtime/user/user.js?' ); foreach ($js_files as $js) { @@ -31,46 +32,71 @@ class UserController extends Zend_Controller_Action $baseUrl.$js.$CC_CONFIG['airtime_version'],'text/javascript'); } - $this->view->headLink()->appendStylesheet($baseUrl.'/css/users.css?'.$CC_CONFIG['airtime_version']); + $this->view->headLink()->appendStylesheet($baseUrl.'css/users.css?'.$CC_CONFIG['airtime_version']); $form = new Application_Form_AddUser(); $this->view->successMessage = ""; if ($request->isPost()) { - if ($form->isValid($request->getPost())) { + $params = $request->getPost(); + $postData = explode('&', $params['data']); + foreach($postData as $k=>$v) { + $v = explode('=', $v); + $formData[$v[0]] = urldecode($v[1]); + } - $formdata = $form->getValues(); - if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 - && $formdata['login'] == 'admin' - && $formdata['user_id'] != 0) { - $this->view->successMessage = "
Specific action is not allowed in demo version!
"; - } elseif ($form->validateLogin($formdata)) { - $user = new Application_Model_User($formdata['user_id']); - $user->setFirstName($formdata['first_name']); - $user->setLastName($formdata['last_name']); - $user->setLogin($formdata['login']); + if ($form->isValid($formData)) { + + if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 + && $formData['login'] == 'admin' + && $formData['user_id'] != 0) { + $this->view->form = $form; + $this->view->successMessage = "
"._("Specific action is not allowed in demo version!")."
"; + die(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml')))); + } elseif ($form->validateLogin($formData)) { + $user = new Application_Model_User($formData['user_id']); + if (empty($formData['user_id'])) { + $user->setLogin($formData['login']); + } + $user->setFirstName($formData['first_name']); + $user->setLastName($formData['last_name']); // We don't allow 6 x's as a password. // The reason is because we that as a password placeholder // on the client side. - if ($formdata['password'] != "xxxxxx") { - $user->setPassword($formdata['password']); + if ($formData['password'] != "xxxxxx") { + $user->setPassword($formData['password']); } - $user->setType($formdata['type']); - $user->setEmail($formdata['email']); - $user->setCellPhone($formdata['cell_phone']); - $user->setSkype($formdata['skype']); - $user->setJabber($formdata['jabber']); + $user->setType($formData['type']); + $user->setEmail($formData['email']); + $user->setCellPhone($formData['cell_phone']); + $user->setSkype($formData['skype']); + $user->setJabber($formData['jabber']); $user->save(); - $form->reset(); + // Language and timezone settings are saved on a per-user basis + // By default, the default language, and timezone setting on + // preferences page is what gets assigned. + Application_Model_Preference::SetUserLocale($user->getId()); + Application_Model_Preference::SetUserTimezone($user->getId()); - if (strlen($formdata['user_id']) == 0) { - $this->view->successMessage = "
User added successfully!
"; + $form->reset(); + $this->view->form = $form; + + if (strlen($formData['user_id']) == 0) { + $this->view->successMessage = "
"._("User added successfully!")."
"; } else { - $this->view->successMessage = "
User updated successfully!
"; + $this->view->successMessage = "
"._("User updated successfully!")."
"; } + + die(json_encode(array("valid"=>"true", "html"=>$this->view->render('user/add-user.phtml')))); + } else { + $this->view->form = $form; + die(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml')))); } + } else { + $this->view->form = $form; + die(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml')))); } } @@ -97,6 +123,52 @@ class UserController extends Zend_Controller_Action $id = $this->_getParam('id'); $this->view->entries = Application_Model_User::GetUserData($id); } + + public function editUserAction() + { + $request = $this->getRequest(); + $form = new Application_Form_EditUser(); + if ($request->isPost()) { + $formData = $request->getPost(); + + if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 + && $formData['cu_login'] == 'admin') { + $this->view->form = $form; + $this->view->successMessage = "
"._("Specific action is not allowed in demo version!")."
"; + die(json_encode(array("html"=>$this->view->render('user/edit-user.phtml')))); + } else if ($form->isValid($formData) && + $form->validateLogin($formData['cu_login'], $formData['cu_user_id'])) { + $user = new Application_Model_User($formData['cu_user_id']); + $user->setFirstName($formData['cu_first_name']); + $user->setLastName($formData['cu_last_name']); + // We don't allow 6 x's as a password. + // The reason is because we use that as a password placeholder + // on the client side. + if ($formData['cu_password'] != "xxxxxx") { + $user->setPassword($formData['cu_password']); + } + $user->setEmail($formData['cu_email']); + $user->setCellPhone($formData['cu_cell_phone']); + $user->setSkype($formData['cu_skype']); + $user->setJabber($formData['cu_jabber']); + $user->save(); + + Application_Model_Preference::SetUserLocale($user->getId(), $formData['cu_locale']); + Application_Model_Preference::SetUserTimezone($user->getId(), $formData['cu_timezone']); + + //configure localization with new locale setting + Application_Model_Locale::configureLocalization($formData['cu_locale']); + //reinitialize form so language gets translated + $form = new Application_Form_EditUser(); + + $this->view->successMessage = "
"._("Settings updated successfully!")."
"; + } + $this->view->form = $form; + $this->view->html = $this->view->render('user/edit-user.phtml'); + } + $this->view->form = $form; + $this->view->html = $this->view->render('user/edit-user.phtml'); + } public function removeUserAction() { @@ -114,7 +186,7 @@ class UserController extends Zend_Controller_Action # only delete when valid action is selected for the owned files if (! in_array($files_action, $valid_actions) ) { return; - } + } $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userId = $userInfo->id; diff --git a/airtime_mvc/application/controllers/WebstreamController.php b/airtime_mvc/application/controllers/WebstreamController.php index ebb5acbf6..8eb9a2ac5 100644 --- a/airtime_mvc/application/controllers/WebstreamController.php +++ b/airtime_mvc/application/controllers/WebstreamController.php @@ -26,11 +26,11 @@ class WebstreamController extends Zend_Controller_Action //we're not saving this primary key in the DB so it's OK to be -1 $webstream->setDbId(-1); - $webstream->setDbName("Untitled Webstream"); + $webstream->setDbName(_("Untitled Webstream")); $webstream->setDbDescription(""); $webstream->setDbUrl("http://"); $webstream->setDbLength("00:30:00"); - $webstream->setDbName("Untitled Webstream"); + $webstream->setDbName(_("Untitled Webstream")); $webstream->setDbCreatorId($userInfo->id); $webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC'))); $webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC'))); @@ -135,7 +135,7 @@ class WebstreamController extends Zend_Controller_Action Application_Model_Library::changePlaylist($streamId, "stream"); - $this->view->statusMessage = "
Webstream saved.
"; + $this->view->statusMessage = "
"._("Webstream saved.")."
"; $this->view->streamId = $streamId; $this->view->length = $di->format("%Hh %Im"); } else { @@ -143,7 +143,7 @@ class WebstreamController extends Zend_Controller_Action } } catch (Exception $e) { Logging::debug($e->getMessage()); - $this->view->statusMessage = "
Invalid form values.
"; + $this->view->statusMessage = "
"._("Invalid form values.")."
"; $this->view->streamId = -1; $this->view->analysis = $analysis; } diff --git a/airtime_mvc/application/controllers/plugins/Acl_plugin.php b/airtime_mvc/application/controllers/plugins/Acl_plugin.php index b28de407a..4cadba9db 100644 --- a/airtime_mvc/application/controllers/plugins/Acl_plugin.php +++ b/airtime_mvc/application/controllers/plugins/Acl_plugin.php @@ -152,7 +152,10 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract $resourceName .= $controller; /** Check if the controller/action can be accessed by the current user */ - if (!$this->getAcl()->isAllowed($this->_roleName, $resourceName, $request->getActionName())) { + if (!$this->getAcl()->has($resourceName) + || !$this->getAcl()->isAllowed($this->_roleName, + $resourceName, + $request->getActionName())) { /** Redirect to access denied page */ $this->denyAccess(); } diff --git a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php index 8bfa71b2f..a2f5b5cf3 100644 --- a/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php +++ b/airtime_mvc/application/forms/AddShowAbsoluteRebroadcastDates.php @@ -23,7 +23,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm $text->setAttrib('class', 'input_text'); $text->addFilter('StringTrim'); $text->addValidator('date', false, array('HH:mm')); - $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered')); + $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))); $text->setRequired(false); $text->setDecorators(array('ViewHelper')); $this->addElement($text); @@ -55,12 +55,12 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm } if (trim($day) == "") { - $this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array("Day must be specified")); + $this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array(_("Day must be specified"))); $valid = false; } if (trim($time) == "") { - $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Time must be specified")); + $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array(_("Time must be specified"))); $valid = false; } @@ -83,7 +83,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm $rebroad_start = new DateTime($rebroad_start); if ($rebroad_start < $show_end) { - $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast")); + $this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array(_("Must wait at least 1 hour to rebroadcast"))); $valid = false; $noError = false; } diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php index b241a54f0..b34aab2e5 100644 --- a/airtime_mvc/application/forms/AddShowLiveStream.php +++ b/airtime_mvc/application/forms/AddShowLiveStream.php @@ -7,13 +7,13 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm public function init() { $cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth"); - $cb_airtime_auth->setLabel("Use Airtime Authentication:") + $cb_airtime_auth->setLabel(_("Use Airtime Authentication:")) ->setRequired(false) ->setDecorators(array('ViewHelper')); $this->addElement($cb_airtime_auth); $cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth"); - $cb_custom_auth ->setLabel("Use Custom Authentication:") + $cb_custom_auth ->setLabel(_("Use Custom Authentication:")) ->setRequired(false) ->setDecorators(array('ViewHelper')); $this->addElement($cb_custom_auth); @@ -23,7 +23,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm $custom_username->setAttrib('class', 'input_text') ->setAttrib('autocomplete', 'off') ->setAllowEmpty(true) - ->setLabel('Custom Username') + ->setLabel(_('Custom Username')) ->setFilters(array('StringTrim')) ->setValidators(array( new ConditionalNotEmpty(array("cb_custom_auth"=>"1")))) @@ -36,7 +36,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm ->setAttrib('autocomplete', 'off') ->setAttrib('renderPassword','true') ->setAllowEmpty(true) - ->setLabel('Custom Password') + ->setLabel(_('Custom Password')) ->setFilters(array('StringTrim')) ->setValidators(array( new ConditionalNotEmpty(array("cb_custom_auth"=>"1")))) @@ -60,12 +60,12 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm if ($data['cb_custom_auth'] == 1) { if (trim($data['custom_username']) == '') { $element = $this->getElement("custom_username"); - $element->addError("Username field cannot be empty."); + $element->addError(_("Username field cannot be empty.")); $isValid = false; } if (trim($data['custom_password']) == '') { $element = $this->getElement("custom_password"); - $element->addError("Password field cannot be empty."); + $element->addError(_("Password field cannot be empty.")); $isValid = false; } } diff --git a/airtime_mvc/application/forms/AddShowRR.php b/airtime_mvc/application/forms/AddShowRR.php index 5c33723b6..f1fc4fcfd 100644 --- a/airtime_mvc/application/forms/AddShowRR.php +++ b/airtime_mvc/application/forms/AddShowRR.php @@ -7,13 +7,13 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm { // Add record element $this->addElement('checkbox', 'add_show_record', array( - 'label' => 'Record from Line In?', + 'label' => _('Record from Line In?'), 'required' => false, )); // Add record element $this->addElement('checkbox', 'add_show_rebroadcast', array( - 'label' => 'Rebroadcast?', + 'label' => _('Rebroadcast?'), 'required' => false, )); } diff --git a/airtime_mvc/application/forms/AddShowRebroadcastDates.php b/airtime_mvc/application/forms/AddShowRebroadcastDates.php index 7bf0ea3a4..74725c98c 100644 --- a/airtime_mvc/application/forms/AddShowRebroadcastDates.php +++ b/airtime_mvc/application/forms/AddShowRebroadcastDates.php @@ -12,7 +12,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm $relativeDates = array(); $relativeDates[""] = ""; for ($i=0; $i<=30; $i++) { - $relativeDates["$i days"] = "+$i days"; + $relativeDates["$i days"] = "+$i "._("days"); } for ($i=1; $i<=10; $i++) { @@ -28,7 +28,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm $text->setAttrib('class', 'input_text'); $text->addFilter('StringTrim'); $text->addValidator('date', false, array('HH:mm')); - $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered')); + $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))); $text->setRequired(false); $text->setDecorators(array('ViewHelper')); $this->addElement($text); @@ -60,12 +60,12 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm } if (trim($days) == "") { - $this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array("Day must be specified")); + $this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array(_("Day must be specified"))); $valid = false; } if (trim($time) == "") { - $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified")); + $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array(_("Time must be specified"))); $valid = false; } @@ -92,7 +92,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm $rebroad_start->add(new DateInterval("P".$day."D")); if ($rebroad_start < $show_end) { - $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast")); + $this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array(_("Must wait at least 1 hour to rebroadcast"))); $valid = false; $noError = false; } diff --git a/airtime_mvc/application/forms/AddShowRepeats.php b/airtime_mvc/application/forms/AddShowRepeats.php index 85bb7cb44..f0c2609e2 100644 --- a/airtime_mvc/application/forms/AddShowRepeats.php +++ b/airtime_mvc/application/forms/AddShowRepeats.php @@ -8,12 +8,12 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm //Add type select $this->addElement('select', 'add_show_repeat_type', array( 'required' => true, - 'label' => 'Repeat Type:', + 'label' => _('Repeat Type:'), 'class' => ' input_select', 'multiOptions' => array( - "0" => "weekly", - "1" => "bi-weekly", - "2" => "monthly" + "0" => _("weekly"), + "1" => _("bi-weekly"), + "2" => _("monthly") ), )); @@ -22,22 +22,22 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm 'multiCheckbox', 'add_show_day_check', array( - 'label' => 'Select Days:', + 'label' => _('Select Days:'), 'required' => false, 'multiOptions' => array( - "0" => "Sun", - "1" => "Mon", - "2" => "Tue", - "3" => "Wed", - "4" => "Thu", - "5" => "Fri", - "6" => "Sat", + "0" => _("Sun"), + "1" => _("Mon"), + "2" => _("Tue"), + "3" => _("Wed"), + "4" => _("Thu"), + "5" => _("Fri"), + "6" => _("Sat"), ), )); // Add end date element $this->addElement('text', 'add_show_end_date', array( - 'label' => 'Date End:', + 'label' => _('Date End:'), 'class' => 'input_text', 'value' => date("Y-m-d"), 'required' => false, @@ -50,7 +50,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm // Add no end element $this->addElement('checkbox', 'add_show_no_end', array( - 'label' => 'No End?', + 'label' => _('No End?'), 'required' => false, 'checked' => true, )); @@ -76,7 +76,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm $end_epoch = strtotime($end_timestamp); if ($end_epoch < $start_epoch) { - $this->getElement('add_show_end_date')->setErrors(array('End date must be after start date')); + $this->getElement('add_show_end_date')->setErrors(array(_('End date must be after start date'))); return false; } diff --git a/airtime_mvc/application/forms/AddShowStyle.php b/airtime_mvc/application/forms/AddShowStyle.php index 6ea301874..e8feeae89 100644 --- a/airtime_mvc/application/forms/AddShowStyle.php +++ b/airtime_mvc/application/forms/AddShowStyle.php @@ -7,7 +7,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm { // Add show background-color input $this->addElement('text', 'add_show_background_color', array( - 'label' => 'Background Colour:', + 'label' => _('Background Colour:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); @@ -19,14 +19,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm 'class' => 'big' )))); + $stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 6); $bg->setValidators(array( - 'Hex', - array('stringLength', false, array(6, 6)) + 'Hex', $stringLengthValidator )); // Add show color input $this->addElement('text', 'add_show_color', array( - 'label' => 'Text Colour:', + 'label' => _('Text Colour:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); @@ -39,8 +39,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm )))); $c->setValidators(array( - 'Hex', - array('stringLength', false, array(6, 6)) + 'Hex', $stringLengthValidator )); } diff --git a/airtime_mvc/application/forms/AddShowWhat.php b/airtime_mvc/application/forms/AddShowWhat.php index 7a092f4b5..20aeb6ef5 100644 --- a/airtime_mvc/application/forms/AddShowWhat.php +++ b/airtime_mvc/application/forms/AddShowWhat.php @@ -4,6 +4,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm { public function init() { + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); // retrieves the length limit for each char field // and store to assoc array $maxLens = Application_Model_Show::getMaxLengths(); @@ -22,27 +23,26 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm // Add name element $this->addElement('text', 'add_show_name', array( - 'label' => 'Name:', + 'label' => _('Name:'), 'class' => 'input_text', 'required' => true, 'filters' => array('StringTrim'), - 'validators' => array('NotEmpty'), - 'value' => 'Untitled Show', - 'validators' => array(array('StringLength', false, array(0, $maxLens['name']))) + 'value' => _('Untitled Show'), + 'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['name']))) )); // Add URL element $this->addElement('text', 'add_show_url', array( - 'label' => 'URL:', + 'label' => _('URL:'), 'class' => 'input_text', 'required' => false, 'filters' => array('StringTrim'), - 'validators' => array('NotEmpty', array('StringLength', false, array(0, $maxLens['url']))) + 'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['url']))) )); // Add genre element $this->addElement('text', 'add_show_genre', array( - 'label' => 'Genre:', + 'label' => _('Genre:'), 'class' => 'input_text', 'required' => false, 'filters' => array('StringTrim'), @@ -51,7 +51,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm // Add the description element $this->addElement('textarea', 'add_show_description', array( - 'label' => 'Description:', + 'label' => _('Description:'), 'required' => false, 'class' => 'input_text_area', 'validators' => array(array('StringLength', false, array(0, $maxLens['description']))) diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 3dbc63b86..2e9b8d5a3 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -9,16 +9,22 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm array('ViewScript', array('viewScript' => 'form/add-show-when.phtml')) )); + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); + $dateValidator = Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD"); + $regexValidator = Application_Form_Helper_ValidationTypes::overrideRegexValidator( + "/^[0-2]?[0-9]:[0-5][0-9]$/", + _("'%value%' does not fit the time format 'HH:mm'")); + // 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:') + ->setLabel(_('Date/Time Start:')) ->setValue(date("Y-m-d")) ->setFilters(array('StringTrim')) ->setValidators(array( - 'NotEmpty', - array('date', false, array('YYYY-MM-DD')))) + $notEmptyValidator, + $dateValidator)) ->setDecorators(array('ViewHelper')); $startDate->setAttrib('alt', 'date'); $this->addElement($startDate); @@ -30,9 +36,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm ->setValue('00:00') ->setFilters(array('StringTrim')) ->setValidators(array( - 'NotEmpty', - array('date', false, array('HH:mm')), - array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Time format should be HH:mm')) + $notEmptyValidator, + $regexValidator ))->setDecorators(array('ViewHelper')); $startTime->setAttrib('alt', 'time'); $this->addElement($startTime); @@ -41,12 +46,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat'); $endDate->class = 'input_text'; $endDate->setRequired(true) - ->setLabel('Date/Time End:') + ->setLabel(_('Date/Time End:')) ->setValue(date("Y-m-d")) ->setFilters(array('StringTrim')) ->setValidators(array( - 'NotEmpty', - array('date', false, array('YYYY-MM-DD')))) + $notEmptyValidator, + $dateValidator)) ->setDecorators(array('ViewHelper')); $endDate->setAttrib('alt', 'date'); $this->addElement($endDate); @@ -58,16 +63,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm ->setValue('01:00') ->setFilters(array('StringTrim')) ->setValidators(array( - 'NotEmpty', - array('date', false, array('HH:mm')), - array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Time format should be HH:mm')))) + $notEmptyValidator, + $regexValidator)) ->setDecorators(array('ViewHelper')); $endTime->setAttrib('alt', 'time'); $this->addElement($endTime); // Add duration element $this->addElement('text', 'add_show_duration', array( - 'label' => 'Duration:', + 'label' => _('Duration:'), 'class' => 'input_text', 'value' => '01h 00m', 'readonly' => true, @@ -76,7 +80,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm // Add repeats element $this->addElement('checkbox', 'add_show_repeats', array( - 'label' => 'Repeats?', + 'label' => _('Repeats?'), 'required' => false, 'decorators' => array('ViewHelper') )); @@ -96,7 +100,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $showEndDateTime = new DateTime($end_time); if ($validateStartDate) { if ($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) { - $this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past')); + $this->getElement('add_show_start_time')->setErrors(array(_('Cannot create show in the past'))); $valid = false; } // if edit action, check if original show start time is in the past. CC-3864 @@ -104,7 +108,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm if ($originalStartDate->getTimestamp() < $nowDateTime->getTimestamp()) { $this->getElement('add_show_start_time')->setValue($originalStartDate->format("H:i")); $this->getElement('add_show_start_date')->setValue($originalStartDate->format("Y-m-d")); - $this->getElement('add_show_start_time')->setErrors(array('Cannot modify start date/time of the show that is already started')); + $this->getElement('add_show_start_time')->setErrors(array(_('Cannot modify start date/time of the show that is already started'))); $this->disableStartDateAndTime(); $valid = false; } @@ -113,7 +117,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm // if end time is in the past, return error if ($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) { - $this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past')); + $this->getElement('add_show_end_time')->setErrors(array(_('End date/time cannot be in the past'))); $valid = false; } @@ -123,15 +127,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm $hours = $matches[1]; $minutes = $matches[2]; if ($formData["add_show_duration"] == "00h 00m") { - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m')); + $this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration 00h 00m'))); $valid = false; } elseif (strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) { if ($hours > 24 || ($hours == 24 && $minutes > 0)) { - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h')); + $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')); + $this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration < 0m'))); $valid = false; } } else { @@ -234,7 +238,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm if ($overlapping) { $valid = false; - $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows')); + $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows'))); break 1; } else { $repeatShowStart->setTimezone($localTimezone); @@ -248,12 +252,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm } } else { $valid = false; - $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows')); + $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows'))); } } else { $overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId); if ($overlapping) { - $this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows')); + $this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows'))); $valid = false; } } diff --git a/airtime_mvc/application/forms/AddShowWho.php b/airtime_mvc/application/forms/AddShowWho.php index 71d9f9fcc..aba16e110 100644 --- a/airtime_mvc/application/forms/AddShowWho.php +++ b/airtime_mvc/application/forms/AddShowWho.php @@ -7,7 +7,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm { // Add hosts autocomplete $this->addElement('text', 'add_show_hosts_autocomplete', array( - 'label' => 'Search Users:', + 'label' => _('Search Users:'), 'class' => 'input_text ui-autocomplete-input', 'required' => false )); @@ -21,7 +21,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm //Add hosts selection $hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts'); - $hosts->setLabel('DJs:') + $hosts->setLabel(_('DJs:')) ->setMultiOptions($options); $this->addElement($hosts); diff --git a/airtime_mvc/application/forms/AddUser.php b/airtime_mvc/application/forms/AddUser.php index 059dbe8af..75a8f659c 100644 --- a/airtime_mvc/application/forms/AddUser.php +++ b/airtime_mvc/application/forms/AddUser.php @@ -10,86 +10,98 @@ class Application_Form_AddUser extends Zend_Form '../application/validate', 'validate'); * */ + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); + $emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator(); + $this->setAttrib('id', 'user_form'); + $hidden = new Zend_Form_Element_Hidden('user_id'); $hidden->setDecorators(array('ViewHelper')); $this->addElement($hidden); $login = new Zend_Form_Element_Text('login'); - $login->setLabel('Username:'); + $login->setLabel(_('Username:')); $login->setAttrib('class', 'input_text'); $login->setRequired(true); + $login->addValidator($notEmptyValidator); $login->addFilter('StringTrim'); //$login->addValidator('UserNameValidate'); $this->addElement($login); $password = new Zend_Form_Element_Password('password'); - $password->setLabel('Password:'); + $password->setLabel(_('Password:')); $password->setAttrib('class', 'input_text'); $password->setRequired(true); $password->addFilter('StringTrim'); - $password->addValidator('NotEmpty'); + $password->addValidator($notEmptyValidator); $this->addElement($password); + $passwordVerify = new Zend_Form_Element_Password('passwordVerify'); + $passwordVerify->setLabel(_('Verify Password:')); + $passwordVerify->setAttrib('class', 'input_text'); + $passwordVerify->setRequired(true); + $passwordVerify->addFilter('StringTrim'); + $passwordVerify->addValidator($notEmptyValidator); + $this->addElement($passwordVerify); + $firstName = new Zend_Form_Element_Text('first_name'); - $firstName->setLabel('Firstname:'); + $firstName->setLabel(_('Firstname:')); $firstName->setAttrib('class', 'input_text'); $firstName->addFilter('StringTrim'); - $firstName->addValidator('NotEmpty'); $this->addElement($firstName); $lastName = new Zend_Form_Element_Text('last_name'); - $lastName->setLabel('Lastname:'); + $lastName->setLabel(_('Lastname:')); $lastName->setAttrib('class', 'input_text'); $lastName->addFilter('StringTrim'); - $lastName->addValidator('NotEmpty'); $this->addElement($lastName); $email = new Zend_Form_Element_Text('email'); - $email->setLabel('Email:'); + $email->setLabel(_('Email:')); $email->setAttrib('class', 'input_text'); $email->addFilter('StringTrim'); $email->setRequired(true); - $email->addValidator('EmailAddress'); + $email->addValidator($notEmptyValidator); + $email->addValidator($emailValidator); $this->addElement($email); $cellPhone = new Zend_Form_Element_Text('cell_phone'); - $cellPhone->setLabel('Mobile Phone:'); + $cellPhone->setLabel(_('Mobile Phone:')); $cellPhone->setAttrib('class', 'input_text'); $cellPhone->addFilter('StringTrim'); $this->addElement($cellPhone); $skype = new Zend_Form_Element_Text('skype'); - $skype->setLabel('Skype:'); + $skype->setLabel(_('Skype:')); $skype->setAttrib('class', 'input_text'); $skype->addFilter('StringTrim'); $this->addElement($skype); $jabber = new Zend_Form_Element_Text('jabber'); - $jabber->setLabel('Jabber:'); + $jabber->setLabel(_('Jabber:')); $jabber->setAttrib('class', 'input_text'); $jabber->addFilter('StringTrim'); - $jabber->addValidator('EmailAddress'); + $jabber->addValidator($emailValidator); $this->addElement($jabber); $select = new Zend_Form_Element_Select('type'); - $select->setLabel('User Type:'); + $select->setLabel(_('User Type:')); $select->setAttrib('class', 'input_select'); $select->setAttrib('style', 'width: 40%'); $select->setMultiOptions(array( - "G" => "Guest", - "H" => "DJ", - "P" => "Program Manager", - "A" => "Admin" + "G" => _("Guest"), + "H" => _("DJ"), + "P" => _("Program Manager"), + "A" => _("Admin") )); $select->setRequired(true); $this->addElement($select); - $submit = new Zend_Form_Element_Submit('submit'); - $submit->setAttrib('class', 'ui-button ui-state-default right-floated'); - $submit->setIgnore(true); - $submit->setLabel('Save'); - $this->addElement($submit); + $saveBtn = new Zend_Form_Element_Button('save_user'); + $saveBtn->setAttrib('class', 'btn btn-small right-floated'); + $saveBtn->setIgnore(true); + $saveBtn->setLabel(_('Save')); + $this->addElement($saveBtn); } public function validateLogin($data) @@ -98,7 +110,7 @@ class Application_Form_AddUser extends Zend_Form $count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count(); if ($count != 0) { - $this->getElement('login')->setErrors(array("Login name is not unique.")); + $this->getElement('login')->setErrors(array(_("Login name is not unique."))); return false; } @@ -106,4 +118,13 @@ class Application_Form_AddUser extends Zend_Form return true; } + + // We need to add the password identical validator here in case + // Zend version is less than 1.10.5 + public function isValid($data) { + $passwordIdenticalValidator = Application_Form_Helper_ValidationTypes::overridePasswordIdenticalValidator( + $data['password']); + $this->getElement('passwordVerify')->addValidator($passwordIdenticalValidator); + return parent::isValid($data); + } } diff --git a/airtime_mvc/application/forms/DateRange.php b/airtime_mvc/application/forms/DateRange.php index 5d04696ed..4d8dd3570 100644 --- a/airtime_mvc/application/forms/DateRange.php +++ b/airtime_mvc/application/forms/DateRange.php @@ -13,7 +13,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm $startDate = new Zend_Form_Element_Text('his_date_start'); $startDate->class = 'input_text'; $startDate->setRequired(true) - ->setLabel('Date Start:') + ->setLabel(_('Date Start:')) ->setValue(date("Y-m-d")) ->setFilters(array('StringTrim')) ->setValidators(array( @@ -32,7 +32,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm ->setValidators(array( 'NotEmpty', array('date', false, array('HH:mm')), - array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); $startTime->setAttrib('alt', 'time'); $this->addElement($startTime); @@ -41,7 +41,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm $endDate = new Zend_Form_Element_Text('his_date_end'); $endDate->class = 'input_text'; $endDate->setRequired(true) - ->setLabel('Date End:') + ->setLabel(_('Date End:')) ->setValue(date("Y-m-d")) ->setFilters(array('StringTrim')) ->setValidators(array( @@ -60,7 +60,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm ->setValidators(array( 'NotEmpty', array('date', false, array('HH:mm')), - array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); $endTime->setAttrib('alt', 'time'); $this->addElement($endTime); diff --git a/airtime_mvc/application/forms/EditAudioMD.php b/airtime_mvc/application/forms/EditAudioMD.php index 2dc9e1f0f..11dda2610 100644 --- a/airtime_mvc/application/forms/EditAudioMD.php +++ b/airtime_mvc/application/forms/EditAudioMD.php @@ -2,82 +2,89 @@ class Application_Form_EditAudioMD extends Zend_Form { - public function init() + + public function init() {} + + public function startForm($p_id) { + $baseUrl = Application_Common_OsPath::getBaseDir(); // Set the method for the display form to POST $this->setMethod('post'); + $this->addElement('hidden', 'file_id', array( + 'value' => $p_id + )); // Add title field $this->addElement('text', 'track_title', array( - 'label' => 'Title:', + 'label' => _('Title:'), 'class' => 'input_text', 'filters' => array('StringTrim'), )); // Add artist field $this->addElement('text', 'artist_name', array( - 'label' => 'Creator:', + 'label' => _('Creator:'), 'class' => 'input_text', 'filters' => array('StringTrim'), )); // Add album field $this->addElement('text', 'album_title', array( - 'label' => 'Album:', + 'label' => _('Album:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add track number field $this->addElement('text', 'track_number', array( - 'label' => 'Track:', + 'label' => _('Track:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add genre field $this->addElement('text', 'genre', array( - 'label' => 'Genre:', + 'label' => _('Genre:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add year field $this->addElement('text', 'year', array( - 'label' => 'Year:', + 'label' => _('Year:'), 'class' => 'input_text', 'filters' => array('StringTrim'), 'validators' => array( - array('date', false, array('YYYY-MM-DD')), - array('date', false, array('YYYY-MM')), - array('date', false, array('YYYY')) + Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD"), + Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM"), + Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY") ) )); // Add label field $this->addElement('text', 'label', array( - 'label' => 'Label:', + 'label' => _('Label:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add composer field $this->addElement('text', 'composer', array( - 'label' => 'Composer:', + 'label' => _('Composer:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add conductor field $this->addElement('text', 'conductor', array( - 'label' => 'Conductor:', + 'label' => _('Conductor:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add mood field $this->addElement('text', 'mood', array( - 'label' => 'Mood:', + 'label' => _('Mood:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); @@ -85,7 +92,7 @@ class Application_Form_EditAudioMD extends Zend_Form // Add bmp field $bpm = new Zend_Form_Element_Text('bpm'); $bpm->class = 'input_text'; - $bpm->setLabel('BPM:') + $bpm->setLabel(_('BPM:')) ->setFilters(array('StringTrim')) ->setValidators(array( new Zend_Validate_StringLength(array('min'=>0,'max' => 8)), @@ -94,54 +101,53 @@ class Application_Form_EditAudioMD extends Zend_Form // Add copyright field $this->addElement('text', 'copyright', array( - 'label' => 'Copyright:', + 'label' => _('Copyright:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add isrc number field $this->addElement('text', 'isrc_number', array( - 'label' => 'ISRC Number:', + 'label' => _('ISRC Number:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add website field $this->addElement('text', 'info_url', array( - 'label' => 'Website:', + 'label' => _('Website:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add language field $this->addElement('text', 'language', array( - 'label' => 'Language:', + 'label' => _('Language:'), 'class' => 'input_text', 'filters' => array('StringTrim') )); // Add the submit button - $this->addElement('submit', 'submit', array( + $this->addElement('button', 'editmdsave', array( 'ignore' => true, 'class' => 'btn', - 'label' => 'Save', + 'label' => _('Save'), 'decorators' => array( 'ViewHelper' ) )); // Add the submit button - $this->addElement('button', 'cancel', array( + $this->addElement('button', 'editmdcancel', array( 'ignore' => true, 'class' => 'btn md-cancel', - 'label' => 'Cancel', - 'onclick' => 'javascript:document.location.href = "/Library"', + 'label' => _('Cancel'), 'decorators' => array( 'ViewHelper' ) )); - $this->addDisplayGroup(array('submit', 'cancel'), 'submitButtons', array( + $this->addDisplayGroup(array('editmdsave', 'editmdcancel'), 'submitButtons', array( 'decorators' => array( 'FormElements', 'DtDdWrapper' diff --git a/airtime_mvc/application/forms/EditUser.php b/airtime_mvc/application/forms/EditUser.php new file mode 100644 index 000000000..cff9dfdda --- /dev/null +++ b/airtime_mvc/application/forms/EditUser.php @@ -0,0 +1,147 @@ +addElementPrefixPath('Application_Validate', + '../application/validate', + 'validate'); + * */ + + $currentUser = Application_Model_User::getCurrentUser(); + $currentUserId = $currentUser->getId(); + $userData = Application_Model_User::GetUserData($currentUserId); + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); + $emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator(); + + $this->setDecorators(array( + array('ViewScript', array('viewScript' => 'form/edit-user.phtml', "currentUser" => $currentUser->getLogin())))); + $this->setAttrib('id', 'current-user-form'); + + $hidden = new Zend_Form_Element_Hidden('cu_user_id'); + $hidden->setDecorators(array('ViewHelper')); + $hidden->setValue($userData["id"]); + $this->addElement($hidden); + + $login = new Zend_Form_Element_Text('cu_login'); + $login->setLabel(_('Username:')); + $login->setValue($userData["login"]); + $login->setAttrib('class', 'input_text'); + $login->setAttrib('readonly', 'readonly'); + $login->setRequired(true); + $login->addValidator($notEmptyValidator); + $login->addFilter('StringTrim'); + $login->setDecorators(array('viewHelper')); + $this->addElement($login); + + $password = new Zend_Form_Element_Password('cu_password'); + $password->setLabel(_('Password:')); + $password->setAttrib('class', 'input_text'); + $password->setRequired(true); + $password->addFilter('StringTrim'); + $password->addValidator($notEmptyValidator); + $password->setDecorators(array('viewHelper')); + $this->addElement($password); + + $passwordVerify = new Zend_Form_Element_Password('cu_passwordVerify'); + $passwordVerify->setLabel(_('Verify Password:')); + $passwordVerify->setAttrib('class', 'input_text'); + $passwordVerify->setRequired(true); + $passwordVerify->addFilter('StringTrim'); + $passwordVerify->addValidator($notEmptyValidator); + $passwordVerify->setDecorators(array('viewHelper')); + $this->addElement($passwordVerify); + + $firstName = new Zend_Form_Element_Text('cu_first_name'); + $firstName->setLabel(_('Firstname:')); + $firstName->setValue($userData["first_name"]); + $firstName->setAttrib('class', 'input_text'); + $firstName->addFilter('StringTrim'); + $firstName->setDecorators(array('viewHelper')); + $this->addElement($firstName); + + $lastName = new Zend_Form_Element_Text('cu_last_name'); + $lastName->setLabel(_('Lastname:')); + $lastName->setValue($userData["last_name"]); + $lastName->setAttrib('class', 'input_text'); + $lastName->addFilter('StringTrim'); + $lastName->setDecorators(array('viewHelper')); + $this->addElement($lastName); + + $email = new Zend_Form_Element_Text('cu_email'); + $email->setLabel(_('Email:')); + $email->setValue($userData["email"]); + $email->setAttrib('class', 'input_text'); + $email->addFilter('StringTrim'); + $email->setRequired(true); + $email->addValidator($notEmptyValidator); + $email->addValidator($emailValidator); + $email->setDecorators(array('viewHelper')); + $this->addElement($email); + + $cellPhone = new Zend_Form_Element_Text('cu_cell_phone'); + $cellPhone->setLabel(_('Mobile Phone:')); + $cellPhone->setValue($userData["cell_phone"]); + $cellPhone->setAttrib('class', 'input_text'); + $cellPhone->addFilter('StringTrim'); + $cellPhone->setDecorators(array('viewHelper')); + $this->addElement($cellPhone); + + $skype = new Zend_Form_Element_Text('cu_skype'); + $skype->setLabel(_('Skype:')); + $skype->setValue($userData["skype_contact"]); + $skype->setAttrib('class', 'input_text'); + $skype->addFilter('StringTrim'); + $skype->setDecorators(array('viewHelper')); + $this->addElement($skype); + + $jabber = new Zend_Form_Element_Text('cu_jabber'); + $jabber->setLabel(_('Jabber:')); + $jabber->setValue($userData["jabber_contact"]); + $jabber->setAttrib('class', 'input_text'); + $jabber->addFilter('StringTrim'); + $jabber->addValidator($emailValidator); + $jabber->setDecorators(array('viewHelper')); + $this->addElement($jabber); + + $locale = new Zend_Form_Element_Select("cu_locale"); + $locale->setLabel(_("Language:")); + $locale->setMultiOptions(Application_Model_Locale::getLocales()); + $locale->setValue(Application_Model_Preference::GetUserLocale($currentUserId)); + $locale->setDecorators(array('ViewHelper')); + $this->addElement($locale); + + $timezone = new Zend_Form_Element_Select("cu_timezone"); + $timezone->setLabel(_("Timezone:")); + $timezone->setMultiOptions(Application_Common_Timezone::getTimezones()); + $timezone->setValue(Application_Model_Preference::GetUserTimezone($currentUserId)); + $timezone->setDecorators(array('ViewHelper')); + $this->addElement($timezone); + } + + public function validateLogin($p_login, $p_userId) { + $count = CcSubjsQuery::create() + ->filterByDbLogin($p_login) + ->filterByDbId($p_userId, Criteria::NOT_EQUAL) + ->count(); + + if ($count != 0) { + $this->getElement('cu_login')->setErrors(array(_("Login name is not unique."))); + return false; + } else { + return true; + } + } + + // We need to add the password identical validator here in case + // Zend version is less than 1.10.5 + public function isValid($data) { + $passwordIdenticalValidator = Application_Form_Helper_ValidationTypes::overridePasswordIdenticalValidator( + $data['cu_password']); + $this->getElement('cu_passwordVerify')->addValidator($passwordIdenticalValidator); + return parent::isValid($data); + } +} diff --git a/airtime_mvc/application/forms/EmailServerPreferences.php b/airtime_mvc/application/forms/EmailServerPreferences.php index 43f953ce2..d49cdd3fb 100644 --- a/airtime_mvc/application/forms/EmailServerPreferences.php +++ b/airtime_mvc/application/forms/EmailServerPreferences.php @@ -13,7 +13,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm // Enable system emails $this->addElement('checkbox', 'enableSystemEmail', array( - 'label' => 'Enable System Emails (Password Reset)', + 'label' => _('Enable System Emails (Password Reset)'), 'required' => false, 'value' => Application_Model_Preference::GetEnableSystemEmail(), 'decorators' => array( @@ -23,14 +23,14 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm $this->addElement('text', 'systemEmail', array( 'class' => 'input_text', - 'label' => 'Reset Password \'From\' Email', + 'label' => _("Reset Password 'From' Email"), 'value' => Application_Model_Preference::GetSystemEmail(), 'readonly' => true, 'decorators' => array('viewHelper') )); $this->addElement('checkbox', 'configureMailServer', array( - 'label' => 'Configure Mail Server', + 'label' => _('Configure Mail Server'), 'required' => false, 'value' => Application_Model_Preference::GetMailServerConfigured(), 'decorators' => array ( @@ -39,7 +39,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm )); $this->addElement('checkbox', 'msRequiresAuth', array( - 'label' => 'Requires Authentication', + 'label' => _('Requires Authentication'), 'required' => false, 'value' => Application_Model_Preference::GetMailServerRequiresAuth(), 'decorators' => array( @@ -49,7 +49,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm $this->addElement('text', 'mailServer', array( 'class' => 'input_text', - 'label' => 'Mail Server', + 'label' => _('Mail Server'), 'value' => Application_Model_Preference::GetMailServer(), 'readonly' => true, 'decorators' => array('viewHelper'), @@ -63,7 +63,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm $this->addElement('text', 'email', array( 'class' => 'input_text', - 'label' => 'Email Address', + 'label' => _('Email Address'), 'value' => Application_Model_Preference::GetMailServerEmailAddress(), 'readonly' => true, 'decorators' => array('viewHelper'), @@ -78,7 +78,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm $this->addElement('password', 'ms_password', array( 'class' => 'input_text', - 'label' => 'Password', + 'label' => _('Password'), 'value' => Application_Model_Preference::GetMailServerPassword(), 'readonly' => true, 'decorators' => array('viewHelper'), @@ -96,7 +96,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm $port->class = 'input_text'; $port->setRequired(false) ->setValue(Application_Model_Preference::GetMailServerPort()) - ->setLabel('Port') + ->setLabel(_('Port')) ->setAttrib('readonly', true) ->setDecorators(array('viewHelper')); diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 9150ba287..7c49ccb38 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -5,6 +5,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm public function init() { + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); $this->setDecorators(array( array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')) )); @@ -17,7 +18,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm //Station name $this->addElement('text', 'stationName', array( 'class' => 'input_text', - 'label' => 'Station Name', + 'label' => _('Station Name'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), @@ -29,12 +30,12 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm //Default station fade $this->addElement('text', 'stationDefaultFade', array( 'class' => 'input_text', - 'label' => 'Default Fade (s):', - 'required' => false, + 'label' => _('Default Fade (s):'), + 'required' => true, 'filters' => array('StringTrim'), - 'validators' => array(array('regex', false, + 'validators' => array(array($notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', - 'messages' => 'enter a time in seconds 0{.0}'))), + 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => $defaultFade, 'decorators' => array( 'ViewHelper' @@ -42,9 +43,10 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm )); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); - $third_party_api->setLabel('Website Widgets:'); - $third_party_api->setMultiOptions(array("Disabled", - "Enabled")); + $third_party_api->setLabel( + sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '
')); + $third_party_api->setMultiOptions(array(_("Disabled"), + _("Enabled"))); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); $third_party_api->setDecorators(array('ViewHelper')); $this->addElement($third_party_api); @@ -63,50 +65,30 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm ) )); + $locale = new Zend_Form_Element_Select("locale"); + $locale->setLabel(_("Default Interface Language")); + $locale->setMultiOptions(Application_Model_Locale::getLocales()); + $locale->setValue(Application_Model_Preference::GetDefaultLocale()); + $locale->setDecorators(array('ViewHelper')); + $this->addElement($locale); + /* Form Element for setting the Timezone */ $timezone = new Zend_Form_Element_Select("timezone"); - $timezone->setLabel("Timezone"); - $timezone->setMultiOptions($this->getTimezones()); - $timezone->setValue(Application_Model_Preference::GetTimezone()); + $timezone->setLabel(_("Default Interface Timezone")); + $timezone->setMultiOptions(Application_Common_Timezone::getTimezones()); + $timezone->setValue(Application_Model_Preference::GetDefaultTimezone()); $timezone->setDecorators(array('ViewHelper')); $this->addElement($timezone); /* Form Element for setting which day is the start of the week */ $week_start_day = new Zend_Form_Element_Select("weekStartDay"); - $week_start_day->setLabel("Week Starts On"); + $week_start_day->setLabel(_("Week Starts On")); $week_start_day->setMultiOptions($this->getWeekStartDays()); $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay()); $week_start_day->setDecorators(array('ViewHelper')); $this->addElement($week_start_day); } - private function getTimezones() - { - $regions = array( - 'Africa' => DateTimeZone::AFRICA, - 'America' => DateTimeZone::AMERICA, - 'Antarctica' => DateTimeZone::ANTARCTICA, - 'Arctic' => DateTimeZone::ARCTIC, - 'Asia' => DateTimeZone::ASIA, - 'Atlantic' => DateTimeZone::ATLANTIC, - 'Australia' => DateTimeZone::AUSTRALIA, - 'Europe' => DateTimeZone::EUROPE, - 'Indian' => DateTimeZone::INDIAN, - 'Pacific' => DateTimeZone::PACIFIC - ); - - $tzlist = array(); - - foreach ($regions as $name => $mask) { - $ids = DateTimeZone::listIdentifiers($mask); - foreach ($ids as $id) { - $tzlist[$id] = str_replace("_", " ", $id); - } - } - - return $tzlist; - } - private static function getWidgetCode() { $host = $_SERVER['SERVER_NAME']; @@ -146,13 +128,13 @@ CODE; private function getWeekStartDays() { $days = array( - 'Sunday', - 'Monday', - 'Tuesday', - 'Wednesday', - 'Thursday', - 'Friday', - 'Saturday' + _('Sunday'), + _('Monday'), + _('Tuesday'), + _('Wednesday'), + _('Thursday'), + _('Friday'), + _('Saturday') ); return $days; diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php index 3388b5a4c..94e654079 100644 --- a/airtime_mvc/application/forms/LiveStreamingPreferences.php +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -5,7 +5,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm public function init() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; $isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true"; @@ -16,24 +16,24 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm // automatic trasition on source disconnection $auto_transition = new Zend_Form_Element_Checkbox("auto_transition"); - $auto_transition->setLabel("Auto Switch Off") + $auto_transition->setLabel(_("Auto Switch Off")) ->setValue(Application_Model_Preference::GetAutoTransition()) ->setDecorators(array('ViewHelper')); $this->addElement($auto_transition); // automatic switch on upon source connection $auto_switch = new Zend_Form_Element_Checkbox("auto_switch"); - $auto_switch->setLabel("Auto Switch On") + $auto_switch->setLabel(_("Auto Switch On")) ->setValue(Application_Model_Preference::GetAutoSwitch()) ->setDecorators(array('ViewHelper')); $this->addElement($auto_switch); // Default transition fade $transition_fade = new Zend_Form_Element_Text("transition_fade"); - $transition_fade->setLabel("Switch Transition Fade (s)") + $transition_fade->setLabel(_("Switch Transition Fade (s)")) ->setFilters(array('StringTrim')) ->addValidator('regex', false, array('/^[0-9]{1,2}(\.\d{1,6})?$/', - 'messages' => 'enter a time in seconds 00{.000000}')) + 'messages' => _('enter a time in seconds 00{.000000}'))) ->setValue($defaultFade) ->setDecorators(array('ViewHelper')); $this->addElement($transition_fade); @@ -42,7 +42,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm $master_username = new Zend_Form_Element_Text('master_username'); $master_username->setAttrib('autocomplete', 'off') ->setAllowEmpty(true) - ->setLabel('Master Username') + ->setLabel(_('Master Username')) ->setFilters(array('StringTrim')) ->setValue(Application_Model_Preference::GetLiveStreamMasterUsername()) ->setDecorators(array('ViewHelper')); @@ -59,7 +59,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm ->setAttrib('renderPassword','true') ->setAllowEmpty(true) ->setValue(Application_Model_Preference::GetLiveStreamMasterPassword()) - ->setLabel('Master Password') + ->setLabel(_('Master Password')) ->setFilters(array('StringTrim')) ->setDecorators(array('ViewHelper')); $this->addElement($master_password); @@ -67,7 +67,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm //Master source connection url $master_dj_connection_url = new Zend_Form_Element_Text('master_dj_connection_url'); $master_dj_connection_url->setAttrib('readonly', true) - ->setLabel('Master Source Connection URL') + ->setLabel(_('Master Source Connection URL')) ->setValue(Application_Model_Preference::GetMasterDJSourceConnectionURL()) ->setDecorators(array('ViewHelper')); $this->addElement($master_dj_connection_url); @@ -75,7 +75,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm //Show source connection url $live_dj_connection_url = new Zend_Form_Element_Text('live_dj_connection_url'); $live_dj_connection_url->setAttrib('readonly', true) - ->setLabel('Show Source Connection URL') + ->setLabel(_('Show Source Connection URL')) ->setValue(Application_Model_Preference::GetLiveDJSourceConnectionURL()) ->setDecorators(array('ViewHelper')); $this->addElement($live_dj_connection_url); @@ -93,7 +93,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm public function updateVariables() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; $master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL(); diff --git a/airtime_mvc/application/forms/Login.php b/airtime_mvc/application/forms/Login.php index 3761ff939..302a06ac0 100644 --- a/airtime_mvc/application/forms/Login.php +++ b/airtime_mvc/application/forms/Login.php @@ -5,7 +5,7 @@ class Application_Form_Login extends Zend_Form public function init() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); // Set the method for the display form to POST $this->setMethod('post'); @@ -16,7 +16,7 @@ class Application_Form_Login extends Zend_Form // Add username element $this->addElement('text', 'username', array( - 'label' => 'Username:', + 'label' => _('Username:'), 'class' => 'input_text', 'required' => true, 'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'', @@ -31,7 +31,7 @@ class Application_Form_Login extends Zend_Form // Add password element $this->addElement('password', 'password', array( - 'label' => 'Password:', + 'label' => _('Password:'), 'class' => 'input_text', 'required' => true, 'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'', @@ -43,6 +43,12 @@ class Application_Form_Login extends Zend_Form 'ViewHelper' ) )); + + $locale = new Zend_Form_Element_Select("locale"); + $locale->setLabel(_("Language:")); + $locale->setMultiOptions(Application_Model_Locale::getLocales()); + $locale->setDecorators(array('ViewHelper')); + $this->addElement($locale); $recaptchaNeeded = false; if (Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3) { @@ -56,7 +62,7 @@ class Application_Form_Login extends Zend_Form // Add the submit button $this->addElement('submit', 'submit', array( 'ignore' => true, - 'label' => 'Login', + 'label' => _('Login'), 'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center', 'decorators' => array( 'ViewHelper' @@ -74,7 +80,7 @@ class Application_Form_Login extends Zend_Form $captcha = new Zend_Form_Element_Captcha('captcha', array( - 'label' => 'Type the characters you see in the picture below.', + 'label' => _('Type the characters you see in the picture below.'), 'captcha' => 'ReCaptcha', 'captchaOptions' => array( 'captcha' => 'ReCaptcha', diff --git a/airtime_mvc/application/forms/PasswordChange.php b/airtime_mvc/application/forms/PasswordChange.php index 48efae5ff..1b93911b0 100644 --- a/airtime_mvc/application/forms/PasswordChange.php +++ b/airtime_mvc/application/forms/PasswordChange.php @@ -9,21 +9,23 @@ class Application_Form_PasswordChange extends Zend_Form $this->setDecorators(array( array('ViewScript', array('viewScript' => 'form/password-change.phtml')) )); + + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); + $stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 80); $this->addElement('password', 'password', array( - 'label' => 'Password', + 'label' => _('Password'), 'required' => true, 'filters' => array('stringTrim'), - 'validators' => array( - array('stringLength', false, array(6, 80)), - ), + 'validators' => array($notEmptyValidator, + $stringLengthValidator), 'decorators' => array( 'ViewHelper' ) )); $this->addElement('password', 'password_confirm', array( - 'label' => 'Confirm new password', + 'label' => _('Confirm new password'), 'required' => true, 'filters' => array('stringTrim'), 'validators' => array( @@ -31,14 +33,14 @@ class Application_Form_PasswordChange extends Zend_Form return $value == $context['password']; }), ), - 'errorMessages' => array("Password confirmation does not match your password."), + 'errorMessages' => array(_("Password confirmation does not match your password.")), 'decorators' => array( 'ViewHelper' ) )); $this->addElement('submit', 'submit', array( - 'label' => 'Get new password', + 'label' => _('Get new password'), 'ignore' => true, 'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center', 'decorators' => array( diff --git a/airtime_mvc/application/forms/PasswordRestore.php b/airtime_mvc/application/forms/PasswordRestore.php index 584e767ad..0e8f4ad9c 100644 --- a/airtime_mvc/application/forms/PasswordRestore.php +++ b/airtime_mvc/application/forms/PasswordRestore.php @@ -11,7 +11,7 @@ class Application_Form_PasswordRestore extends Zend_Form )); $this->addElement('text', 'email', array( - 'label' => 'E-mail', + 'label' => _('E-mail'), 'required' => true, 'filters' => array( 'stringTrim', @@ -22,7 +22,7 @@ class Application_Form_PasswordRestore extends Zend_Form )); $this->addElement('text', 'username', array( - 'label' => 'Username', + 'label' => _('Username'), 'required' => false, 'filters' => array( 'stringTrim', @@ -33,7 +33,7 @@ class Application_Form_PasswordRestore extends Zend_Form )); $this->addElement('submit', 'submit', array( - 'label' => 'Restore password', + 'label' => _('Restore password'), 'ignore' => true, 'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center', 'decorators' => array( @@ -43,7 +43,7 @@ class Application_Form_PasswordRestore extends Zend_Form $cancel = new Zend_Form_Element_Button("cancel"); $cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center'; - $cancel->setLabel("Cancel") + $cancel->setLabel(_("Cancel")) ->setIgnore(True) ->setAttrib('onclick', 'redirectToLogin();') ->setDecorators(array('ViewHelper')); diff --git a/airtime_mvc/application/forms/Preferences.php b/airtime_mvc/application/forms/Preferences.php index 3e1490966..1bb7d8efa 100644 --- a/airtime_mvc/application/forms/Preferences.php +++ b/airtime_mvc/application/forms/Preferences.php @@ -4,7 +4,8 @@ class Application_Form_Preferences extends Zend_Form { public function init() { - $this->setAction('/Preference'); + $baseUrl = Application_Common_OsPath::getBaseDir(); + $this->setMethod('post'); $this->setDecorators(array( @@ -17,13 +18,5 @@ class Application_Form_Preferences extends Zend_Form $soundcloud_pref = new Application_Form_SoundcloudPreferences(); $this->addSubForm($soundcloud_pref, 'preferences_soundcloud'); - $this->addElement('submit', 'submit', array( - 'class' => 'ui-button ui-state-default right-floated', - 'ignore' => true, - 'label' => 'Save', - 'decorators' => array( - 'ViewHelper' - ) - )); } } diff --git a/airtime_mvc/application/forms/RegisterAirtime.php b/airtime_mvc/application/forms/RegisterAirtime.php index 9ffd853e1..d1557612a 100644 --- a/airtime_mvc/application/forms/RegisterAirtime.php +++ b/airtime_mvc/application/forms/RegisterAirtime.php @@ -7,7 +7,7 @@ class Application_Form_RegisterAirtime extends Zend_Form public function init() { - $this->setAction('/Showbuilder'); + $this->setAction(Application_Common_OsPath::getBaseDir().'/Showbuilder'); $this->setMethod('post'); $country_list = Application_Model_Preference::GetCountryList(); @@ -27,7 +27,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Station Name $stnName = new Zend_Form_Element_Text("stnName"); - $stnName->setLabel("Station Name") + $stnName->setLabel(_("Station Name")) ->setRequired(true) ->setValue(Application_Model_Preference::GetStationName()) ->setDecorators(array('ViewHelper')); @@ -36,7 +36,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Phone number $this->addElement('text', 'Phone', array( 'class' => 'input_text', - 'label' => 'Phone:', + 'label' => _('Phone:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), @@ -48,7 +48,7 @@ class Application_Form_RegisterAirtime extends Zend_Form //Email $this->addElement('text', 'Email', array( 'class' => 'input_text', - 'label' => 'Email:', + 'label' => _('Email:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), @@ -59,7 +59,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Station Web Site $this->addElement('text', 'StationWebSite', array( - 'label' => 'Station Web Site:', + 'label' => _('Station Web Site:'), 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationWebSite(), @@ -70,7 +70,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // county list dropdown $this->addElement('select', 'Country', array( - 'label' => 'Country:', + 'label' => _('Country:'), 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, @@ -81,7 +81,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Station city $this->addElement('text', 'City', array( - 'label' => 'City:', + 'label' => _('City:'), 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), @@ -93,7 +93,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Station Description $description = new Zend_Form_Element_Textarea('Description'); $description->class = 'input_text_area'; - $description->setLabel('Station Description:') + $description->setLabel(_('Station Description:')) ->setRequired(false) ->setValue(Application_Model_Preference::GetStationDescription()) ->setDecorators(array('ViewHelper')) @@ -103,7 +103,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // Station Logo $upload = new Zend_Form_Element_File('Logo'); - $upload->setLabel('Station Logo:') + $upload->setLabel(_('Station Logo:')) ->setRequired(false) ->setDecorators(array('File')) ->addValidator('Count', false, 1) @@ -113,7 +113,7 @@ class Application_Form_RegisterAirtime extends Zend_Form //enable support feedback $this->addElement('checkbox', 'SupportFeedback', array( - 'label' => 'Send support feedback', + 'label' => _('Send support feedback'), 'required' => false, 'value' => 1, 'decorators' => array( @@ -123,7 +123,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // checkbox for publicise $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); - $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org') + $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org')) ->setRequired(false) ->setDecorators(array('ViewHelper')) ->setValue(Application_Model_Preference::GetPublicise()); @@ -145,7 +145,10 @@ class Application_Form_RegisterAirtime extends Zend_Form // checkbox for privacy policy $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); - $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's privacy policy.") + $checkboxPrivacy->setLabel( + sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."), + "", + "")) ->setDecorators(array('ViewHelper')); $this->addElement($checkboxPrivacy); } @@ -160,7 +163,7 @@ class Application_Form_RegisterAirtime extends Zend_Form if (isset($data["Privacy"])) { $checkPrivacy = $this->getElement('Privacy'); if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") { - $checkPrivacy->addError("You have to agree to privacy policy."); + $checkPrivacy->addError(_("You have to agree to privacy policy.")); $isValid = false; } } diff --git a/airtime_mvc/application/forms/ShowBuilder.php b/airtime_mvc/application/forms/ShowBuilder.php index 465d2dd71..291caccc2 100644 --- a/airtime_mvc/application/forms/ShowBuilder.php +++ b/airtime_mvc/application/forms/ShowBuilder.php @@ -15,7 +15,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm $startDate = new Zend_Form_Element_Text('sb_date_start'); $startDate->class = 'input_text'; $startDate->setRequired(true) - ->setLabel('Date Start:') + ->setLabel(_('Date Start:')) ->setValue(date("Y-m-d")) ->setFilters(array('StringTrim')) ->setValidators(array( @@ -34,7 +34,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm ->setValidators(array( 'NotEmpty', array('date', false, array('HH:mm')), - array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); $startTime->setAttrib('alt', 'time'); $this->addElement($startTime); @@ -43,7 +43,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm $endDate = new Zend_Form_Element_Text('sb_date_end'); $endDate->class = 'input_text'; $endDate->setRequired(true) - ->setLabel('Date End:') + ->setLabel(_('Date End:')) ->setValue(date("Y-m-d")) ->setFilters(array('StringTrim')) ->setValidators(array( @@ -62,14 +62,14 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm ->setValidators(array( 'NotEmpty', array('date', false, array('HH:mm')), - array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); $endTime->setAttrib('alt', 'time'); $this->addElement($endTime); // add a select to choose a show. $showSelect = new Zend_Form_Element_Select("sb_show_filter"); - $showSelect->setLabel("Show:"); + $showSelect->setLabel(_("Show:")); $showSelect->setMultiOptions($this->getShowNames()); $showSelect->setValue(null); $showSelect->setDecorators(array('ViewHelper')); @@ -77,7 +77,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm if ($user->getType() === 'H') { $myShows = new Zend_Form_Element_Checkbox('sb_my_shows'); - $myShows->setLabel('All My Shows:') + $myShows->setLabel(_('All My Shows:')) ->setDecorators(array('ViewHelper')); $this->addElement($myShows); } diff --git a/airtime_mvc/application/forms/SmartBlockCriteria.php b/airtime_mvc/application/forms/SmartBlockCriteria.php index e48fc7590..f47117b63 100644 --- a/airtime_mvc/application/forms/SmartBlockCriteria.php +++ b/airtime_mvc/application/forms/SmartBlockCriteria.php @@ -1,88 +1,119 @@ "Select criteria", - "album_title" => "Album", - "bit_rate" => "Bit Rate (Kbps)", - "bpm" => "BPM", - "composer" => "Composer", - "conductor" => "Conductor", - "copyright" => "Copyright", - "artist_name" => "Creator", - "encoded_by" => "Encoded By", - "genre" => "Genre", - "isrc_number" => "ISRC", - "label" => "Label", - "language" => "Language", - "mtime" => "Last Modified", - "lptime" => "Last Played", - "length" => "Length", - "mime" => "Mime", - "mood" => "Mood", - "owner_id" => "Owner", - "replay_gain" => "Replay Gain", - "sample_rate" => "Sample Rate (kHz)", - "track_title" => "Title", - "track_number" => "Track Number", - "utime" => "Uploaded", - "info_url" => "Website", - "year" => "Year" - ); - + private $criteriaOptions; + private $stringCriteriaOptions; + private $numericCriteriaOptions; + private $limitOptions; private $criteriaTypes = array( - 0 => "", - "album_title" => "s", - "bit_rate" => "n", - "bpm" => "n", - "composer" => "s", - "conductor" => "s", - "copyright" => "s", - "artist_name" => "s", - "encoded_by" => "s", - "utime" => "n", - "mtime" => "n", - "lptime" => "n", - "genre" => "s", - "isrc_number" => "s", - "label" => "s", - "language" => "s", - "length" => "n", - "mime" => "s", - "mood" => "s", - "owner_id" => "s", - "replay_gain" => "n", - "sample_rate" => "n", - "track_title" => "s", - "track_number" => "n", - "info_url" => "s", - "year" => "n" + 0 => "", + "album_title" => "s", + "bit_rate" => "n", + "bpm" => "n", + "composer" => "s", + "conductor" => "s", + "copyright" => "s", + "artist_name" => "s", + "encoded_by" => "s", + "utime" => "n", + "mtime" => "n", + "lptime" => "n", + "genre" => "s", + "isrc_number" => "s", + "label" => "s", + "language" => "s", + "length" => "n", + "mime" => "s", + "mood" => "s", + "owner_id" => "s", + "replay_gain" => "n", + "sample_rate" => "n", + "track_title" => "s", + "track_number" => "n", + "info_url" => "s", + "year" => "n" ); + + private function getCriteriaOptions($option = null) + { + if (!isset($this->criteriaOptions)) { + $this->criteriaOptions = array( + 0 => _("Select criteria"), + "album_title" => _("Album"), + "bit_rate" => _("Bit Rate (Kbps)"), + "bpm" => _("BPM"), + "composer" => _("Composer"), + "conductor" => _("Conductor"), + "copyright" => _("Copyright"), + "artist_name" => _("Creator"), + "encoded_by" => _("Encoded By"), + "genre" => _("Genre"), + "isrc_number" => _("ISRC"), + "label" => _("Label"), + "language" => _("Language"), + "mtime" => _("Last Modified"), + "lptime" => _("Last Played"), + "length" => _("Length"), + "mime" => _("Mime"), + "mood" => _("Mood"), + "owner_id" => _("Owner"), + "replay_gain" => _("Replay Gain"), + "sample_rate" => _("Sample Rate (kHz)"), + "track_title" => _("Title"), + "track_number" => _("Track Number"), + "utime" => _("Uploaded"), + "info_url" => _("Website"), + "year" => _("Year") + ); + } + + if (is_null($option)) return $this->criteriaOptions; + else return $this->criteriaOptions[$option]; + } - private $stringCriteriaOptions = array( - "0" => "Select modifier", - "contains" => "contains", - "does not contain" => "does not contain", - "is" => "is", - "is not" => "is not", - "starts with" => "starts with", - "ends with" => "ends with" - ); + private function getStringCriteriaOptions() + { + if (!isset($this->stringCriteriaOptions)) { + $this->stringCriteriaOptions = array( + "0" => _("Select modifier"), + "contains" => _("contains"), + "does not contain" => _("does not contain"), + "is" => _("is"), + "is not" => _("is not"), + "starts with" => _("starts with"), + "ends with" => _("ends with") + ); + } + return $this->stringCriteriaOptions; + } - private $numericCriteriaOptions = array( - "0" => "Select modifier", - "is" => "is", - "is not" => "is not", - "is greater than" => "is greater than", - "is less than" => "is less than", - "is in the range" => "is in the range" - ); + private function getNumericCriteriaOptions() + { + if (!isset($this->numericCriteriaOptions)) { + $this->numericCriteriaOptions = array( + "0" => _("Select modifier"), + "is" => _("is"), + "is not" => _("is not"), + "is greater than" => _("is greater than"), + "is less than" => _("is less than"), + "is in the range" => _("is in the range") + ); + } + return $this->numericCriteriaOptions; + } - private $limitOptions = array( - "hours" => "hours", - "minutes" => "minutes", - "items" => "items" - ); + private function getLimitOptions() + { + if (!isset($this->limitOptions)) { + $this->limitOptions = array( + "hours" => _("hours"), + "minutes" => _("minutes"), + "items" => _("items") + ); + } + return $this->limitOptions; + } + public function init() { @@ -99,11 +130,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm } $spType = new Zend_Form_Element_Radio('sp_type'); - $spType->setLabel('Set smart block type:') + $spType->setLabel(_('Set smart block type:')) ->setDecorators(array('viewHelper')) ->setMultiOptions(array( - 'static' => 'Static', - 'dynamic' => 'Dynamic' + 'static' => _('Static'), + 'dynamic' => _('Dynamic') )) ->setValue($blockType); $this->addElement($spType); @@ -126,7 +157,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm if (isset($storedCrit["crit"])) { $criteriaKeys = array_keys($storedCrit["crit"]); } - $numElements = count($this->criteriaOptions); + $numElements = count($this->getCriteriaOptions()); for ($i = 0; $i < $numElements; $i++) { $criteriaType = ""; @@ -153,7 +184,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $criteria->setAttrib('class', 'input_select sp_input_select'.$invisible) ->setValue('Select criteria') ->setDecorators(array('viewHelper')) - ->setMultiOptions($this->criteriaOptions); + ->setMultiOptions($this->getCriteriaOptions()); if ($i != 0 && !isset($criteriaKeys[$i])) { $criteria->setAttrib('disabled', 'disabled'); } @@ -174,13 +205,13 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm } if (isset($criteriaKeys[$i])) { if ($criteriaType == "s") { - $criteriaModifers->setMultiOptions($this->stringCriteriaOptions); + $criteriaModifers->setMultiOptions($this->getStringCriteriaOptions()); } else { - $criteriaModifers->setMultiOptions($this->numericCriteriaOptions); + $criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions()); } $criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]); } else { - $criteriaModifers->setMultiOptions(array('0' => 'Select modifier')); + $criteriaModifers->setMultiOptions(array('0' => _('Select modifier'))); } $this->addElement($criteriaModifers); @@ -214,7 +245,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks'); $repeatTracks->setDecorators(array('viewHelper')) - ->setLabel('Allow Repeat Tracks:'); + ->setLabel(_('Allow Repeat Tracks:')); if (isset($storedCrit["repeat_tracks"])) { $repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false); } @@ -223,7 +254,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $limit = new Zend_Form_Element_Select('sp_limit_options'); $limit->setAttrib('class', 'sp_input_select') ->setDecorators(array('viewHelper')) - ->setMultiOptions($this->limitOptions); + ->setMultiOptions($this->getLimitOptions()); if (isset($storedCrit["limit"])) { $limit->setValue($storedCrit["limit"]["modifier"]); } @@ -231,7 +262,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $limitValue = new Zend_Form_Element_Text('sp_limit_value'); $limitValue->setAttrib('class', 'sp_input_text_limit') - ->setLabel('Limit to') + ->setLabel(_('Limit to')) ->setDecorators(array('viewHelper')); $this->addElement($limitValue); if (isset($storedCrit["limit"])) { @@ -253,23 +284,23 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $generate = new Zend_Form_Element_Button('generate_button'); $generate->setAttrib('class', 'btn btn-small'); - $generate->setAttrib('title', 'Generate playlist content and save criteria'); + $generate->setAttrib('title', _('Generate playlist content and save criteria')); $generate->setIgnore(true); - $generate->setLabel('Generate'); + $generate->setLabel(_('Generate')); $generate->setDecorators(array('viewHelper')); $this->addElement($generate); $shuffle = new Zend_Form_Element_Button('shuffle_button'); $shuffle->setAttrib('class', 'btn btn-small'); - $shuffle->setAttrib('title', 'Shuffle playlist content'); + $shuffle->setAttrib('title', _('Shuffle playlist content')); $shuffle->setIgnore(true); - $shuffle->setLabel('Shuffle'); + $shuffle->setLabel(_('Shuffle')); $shuffle->setDecorators(array('viewHelper')); $this->addElement($shuffle); $this->setDecorators(array( array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption"=> $openSmartBlockOption, - 'criteriasLength' => count($this->criteriaOptions), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap, + 'criteriasLength' => count($this->getCriteriaOptions()), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap, 'showPoolCount' => $showPoolCount)) )); } @@ -278,24 +309,24 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm { $data = Application_Model_Block::organizeSmartPlyalistCriteria($params['data']); // add elelments that needs to be added - // set multioption for modifier according to creiteria_field + // set multioption for modifier according to criteria_field $modRowMap = array(); foreach ($data['criteria'] as $critKey=>$d) { $count = 1; foreach ($d as $modKey=>$modInfo) { if ($modKey == 0) { $eleCrit = $this->getElement("sp_criteria_field_".$critKey."_".$modKey); - $eleCrit->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]); + $eleCrit->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field'])); $eleCrit->setAttrib("disabled", null); $eleMod = $this->getElement("sp_criteria_modifier_".$critKey."_".$modKey); $criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']]; if ($criteriaType == "s") { - $eleMod->setMultiOptions($this->stringCriteriaOptions); + $eleMod->setMultiOptions($this->getStringCriteriaOptions()); } elseif ($criteriaType == "n") { - $eleMod->setMultiOptions($this->numericCriteriaOptions); + $eleMod->setMultiOptions($this->getNumericCriteriaOptions()); } else { - $eleMod->setMultiOptions(array('0' => 'Select modifier')); + $eleMod->setMultiOptions(array('0' => _('Select modifier'))); } $eleMod->setValue($modInfo['sp_criteria_modifier']); $eleMod->setAttrib("disabled", null); @@ -316,10 +347,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $criteria->setAttrib('class', 'input_select sp_input_select sp-invisible') ->setValue('Select criteria') ->setDecorators(array('viewHelper')) - ->setMultiOptions($this->criteriaOptions); + ->setMultiOptions($this->getCriteriaOptions()); $criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']]; - $criteria->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]); + $criteria->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field'])); $this->addElement($criteria); /****************** MODIFIER ***********/ @@ -329,11 +360,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm ->setDecorators(array('viewHelper')); if ($criteriaType == "s") { - $criteriaModifers->setMultiOptions($this->stringCriteriaOptions); + $criteriaModifers->setMultiOptions($this->getStringCriteriaOptions()); } elseif ($criteriaType == "n") { - $criteriaModifers->setMultiOptions($this->numericCriteriaOptions); + $criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions()); } else { - $criteriaModifers->setMultiOptions(array('0' => 'Select modifier')); + $criteriaModifers->setMultiOptions(array('0' => _('Select modifier'))); } $criteriaModifers->setValue($modInfo['sp_criteria_modifier']); $this->addElement($criteriaModifers); @@ -427,25 +458,25 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm if ($data['etc']['sp_limit_options'] == 'hours' || $data['etc']['sp_limit_options'] == 'mins') { $element = $this->getElement("sp_limit_value"); if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) { - $element->addError("Limit cannot be empty or smaller than 0"); + $element->addError(_("Limit cannot be empty or smaller than 0")); $isValid = false; } else { $mins = floatval($data['etc']['sp_limit_value']) * $multiplier; if ($mins > 1440) { - $element->addError("Limit cannot be more than 24 hrs"); + $element->addError(_("Limit cannot be more than 24 hrs")); $isValid = false; } } } else { $element = $this->getElement("sp_limit_value"); if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) { - $element->addError("Limit cannot be empty or smaller than 0"); + $element->addError(_("Limit cannot be empty or smaller than 0")); $isValid = false; } elseif (!ctype_digit($data['etc']['sp_limit_value'])) { - $element->addError("The value should be an integer"); + $element->addError(_("The value should be an integer")); $isValid = false; } elseif (intval($data['etc']['sp_limit_value']) > 500) { - $element->addError("500 is the max item limit value you can set"); + $element->addError(_("500 is the max item limit value you can set")); $isValid = false; } } @@ -456,19 +487,19 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm $element = $this->getElement("sp_criteria_field_".$rowKey."_".$key); // check for not selected select box if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0") { - $element->addError("You must select Criteria and Modifier"); + $element->addError(_("You must select Criteria and Modifier")); $isValid = false; } else { $column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]); // validation on type of column if ($d['sp_criteria_field'] == 'length') { if (!preg_match("/^(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) { - $element->addError("'Length' should be in '00:00:00' format"); + $element->addError(_("'Length' should be in '00:00:00' format")); $isValid = false; } } elseif ($column->getType() == PropelColumnTypes::TIMESTAMP) { if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) { - $element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00"); + $element->addError(_("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00)")); $isValid = false; } else { $result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value']); @@ -481,7 +512,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm if (isset($d['sp_criteria_extra'])) { if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) { - $element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00"); + $element->addError(_("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00)")); $isValid = false; } else { $result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra']); @@ -495,24 +526,24 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm } elseif ($column->getType() == PropelColumnTypes::INTEGER && $d['sp_criteria_field'] != 'owner_id') { if (!is_numeric($d['sp_criteria_value'])) { - $element->addError("The value has to be numeric"); + $element->addError(_("The value has to be numeric")); $isValid = false; } // length check if (intval($d['sp_criteria_value']) >= pow(2,31)) { - $element->addError("The value should be less then 2147483648"); + $element->addError(_("The value should be less then 2147483648")); $isValid = false; } } elseif ($column->getType() == PropelColumnTypes::VARCHAR) { if (strlen($d['sp_criteria_value']) > $column->getSize()) { - $element->addError("The value should be less ".$column->getSize()." characters"); + $element->addError(sprintf(_("The value should be less than %s characters"), $column->getSize())); $isValid = false; } } } if ($d['sp_criteria_value'] == "") { - $element->addError("Value cannot be empty"); + $element->addError(_("Value cannot be empty")); $isValid = false; } }//end foreach diff --git a/airtime_mvc/application/forms/SoundcloudPreferences.php b/airtime_mvc/application/forms/SoundcloudPreferences.php index 848368697..3d1563a65 100644 --- a/airtime_mvc/application/forms/SoundcloudPreferences.php +++ b/airtime_mvc/application/forms/SoundcloudPreferences.php @@ -13,7 +13,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm //enable soundcloud uploads option $this->addElement('checkbox', 'UploadToSoundcloudOption', array( - 'label' => 'Enable SoundCloud Upload', + 'label' => _('Enable SoundCloud Upload'), 'required' => false, 'value' => Application_Model_Preference::GetUploadToSoundcloudOption(), 'decorators' => array( @@ -23,7 +23,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm //enable downloadable for soundcloud $this->addElement('checkbox', 'SoundCloudDownloadbleOption', array( - 'label' => 'Automatically Mark Files "Downloadable" on SoundCloud', + 'label' => _('Automatically Mark Files "Downloadable" on SoundCloud'), 'required' => false, 'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(), 'decorators' => array( @@ -34,7 +34,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm //SoundCloud Username $this->addElement('text', 'SoundCloudUser', array( 'class' => 'input_text', - 'label' => 'SoundCloud Email', + 'label' => _('SoundCloud Email'), 'filters' => array('StringTrim'), 'autocomplete' => 'off', 'value' => Application_Model_Preference::GetSoundCloudUser(), @@ -54,7 +54,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm //SoundCloud Password $this->addElement('password', 'SoundCloudPassword', array( 'class' => 'input_text', - 'label' => 'SoundCloud Password', + 'label' => _('SoundCloud Password'), 'filters' => array('StringTrim'), 'autocomplete' => 'off', 'value' => Application_Model_Preference::GetSoundCloudPassword(), @@ -74,7 +74,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm // Add the description element $this->addElement('textarea', 'SoundCloudTags', array( - 'label' => 'SoundCloud Tags: (separate tags with spaces)', + 'label' => _('SoundCloud Tags: (separate tags with spaces)'), 'required' => false, 'class' => 'input_text_area', 'value' => Application_Model_Preference::GetSoundCloudTags(), @@ -86,7 +86,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm //SoundCloud default genre $this->addElement('text', 'SoundCloudGenre', array( 'class' => 'input_text', - 'label' => 'Default Genre:', + 'label' => _('Default Genre:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudGenre(), @@ -96,23 +96,23 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm )); $select = new Zend_Form_Element_Select('SoundCloudTrackType'); - $select->setLabel('Default Track Type:'); + $select->setLabel(_('Default Track Type:')); $select->setAttrib('class', 'input_select'); $select->setMultiOptions(array( "" => "", - "original" => "Original", - "remix" => "Remix", - "live" => "Live", - "recording" => "Recording", - "spoken" => "Spoken", - "podcast" => "Podcast", - "demo" => "Demo", - "in progress" => "Work in progress", - "stem" => "Stem", - "loop" => "Loop", - "sound effect" => "Sound Effect", - "sample" => "One Shot Sample", - "other" => "Other" + "original" => _("Original"), + "remix" => _("Remix"), + "live" => _("Live"), + "recording" => _("Recording"), + "spoken" => _("Spoken"), + "podcast" => _("Podcast"), + "demo" => _("Demo"), + "in progress" => _("Work in progress"), + "stem" => _("Stem"), + "loop" => _("Loop"), + "sound effect" => _("Sound Effect"), + "sample" => _("One Shot Sample"), + "other" => _("Other") )); $select->setRequired(false); $select->setValue(Application_Model_Preference::GetSoundCloudTrackType()); @@ -120,18 +120,18 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm $this->addElement($select); $select = new Zend_Form_Element_Select('SoundCloudLicense'); - $select->setLabel('Default License:'); + $select->setLabel(_('Default License:')); $select->setAttrib('class', 'input_select'); $select->setMultiOptions(array( "" => "", - "no-rights-reserved" => "The work is in the public domain", - "all-rights-reserved" => "All rights are reserved", - "cc-by" => "Creative Commons Attribution", - "cc-by-nc" => "Creative Commons Attribution Noncommercial", - "cc-by-nd" => "Creative Commons Attribution No Derivative Works", - "cc-by-sa" => "Creative Commons Attribution Share Alike", - "cc-by-nc-nd" => "Creative Commons Attribution Noncommercial Non Derivate Works", - "cc-by-nc-sa" => "Creative Commons Attribution Noncommercial Share Alike" + "no-rights-reserved" => _("The work is in the public domain"), + "all-rights-reserved" => _("All rights are reserved"), + "cc-by" => _("Creative Commons Attribution"), + "cc-by-nc" => _("Creative Commons Attribution Noncommercial"), + "cc-by-nd" => _("Creative Commons Attribution No Derivative Works"), + "cc-by-sa" => _("Creative Commons Attribution Share Alike"), + "cc-by-nc-nd" => _("Creative Commons Attribution Noncommercial Non Derivate Works"), + "cc-by-nc-sa" => _("Creative Commons Attribution Noncommercial Share Alike") )); $select->setRequired(false); $select->setValue(Application_Model_Preference::GetSoundCloudLicense()); diff --git a/airtime_mvc/application/forms/StreamSetting.php b/airtime_mvc/application/forms/StreamSetting.php index c3443a3e0..1eb467161 100644 --- a/airtime_mvc/application/forms/StreamSetting.php +++ b/airtime_mvc/application/forms/StreamSetting.php @@ -19,7 +19,7 @@ class Application_Form_StreamSetting extends Zend_Form $setting = $this->setting; if (Application_Model_Preference::GetPlanLevel() == 'disabled') { $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device'); - $output_sound_device->setLabel('Hardware Audio Output') + $output_sound_device->setLabel(_('Hardware Audio Output')) ->setRequired(false) ->setValue(($setting['output_sound_device'] == "true")?1:0) ->setDecorators(array('ViewHelper')); @@ -30,7 +30,7 @@ class Application_Form_StreamSetting extends Zend_Form $output_types = array("ALSA"=>"ALSA", "AO"=>"AO", "OSS"=>"OSS", "Portaudio"=>"Portaudio", "Pulseaudio"=>"Pulseaudio"); $output_type = new Zend_Form_Element_Select('output_sound_device_type'); - $output_type->setLabel("Output Type") + $output_type->setLabel(_("Output Type")) ->setMultiOptions($output_types) ->setValue($setting['output_sound_device_type']) ->setDecorators(array('ViewHelper')); @@ -41,7 +41,7 @@ class Application_Form_StreamSetting extends Zend_Form } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); - $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata') + $icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata')) ->setRequired(false) ->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0) ->setDecorators(array('ViewHelper')); @@ -51,13 +51,32 @@ class Application_Form_StreamSetting extends Zend_Form $this->addElement($icecast_vorbis_metadata); $stream_format = new Zend_Form_Element_Radio('streamFormat'); - $stream_format->setLabel('Stream Label:'); - $stream_format->setMultiOptions(array("Artist - Title", - "Show - Artist - Title", - "Station name - Show name")); + $stream_format->setLabel(_('Stream Label:')); + $stream_format->setMultiOptions(array(_("Artist - Title"), + _("Show - Artist - Title"), + _("Station name - Show name"))); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); + + $offAirMeta = new Zend_Form_Element_Text('offAirMeta'); + $offAirMeta->setLabel(_('Off Air Metadata')) + ->setValue(Application_Model_StreamSetting::getOffAirMeta()) + ->setDecorators(array('ViewHelper')); + $this->addElement($offAirMeta); + + $enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain"); + $enable_replay_gain->setLabel(_("Enable Replay Gain")) + ->setValue(Application_Model_Preference::GetEnableReplayGain()) + ->setDecorators(array('ViewHelper')); + $this->addElement($enable_replay_gain); + + $replay_gain = new Zend_Form_Element_Hidden("replayGainModifier"); + $replay_gain->setLabel(_("Replay Gain Modifier")) + ->setValue(Application_Model_Preference::getReplayGainModifier()) + ->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;")) + ->setDecorators(array('ViewHelper')); + $this->addElement($replay_gain); } public function isValid($data) diff --git a/airtime_mvc/application/forms/StreamSettingSubForm.php b/airtime_mvc/application/forms/StreamSettingSubForm.php index 6a243d12f..eea40d8a7 100644 --- a/airtime_mvc/application/forms/StreamSettingSubForm.php +++ b/airtime_mvc/application/forms/StreamSettingSubForm.php @@ -45,7 +45,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $disable_all = Application_Model_Preference::GetEnableStreamConf() == "false"; $enable = new Zend_Form_Element_Checkbox('enable'); - $enable->setLabel('Enabled:') + $enable->setLabel(_('Enabled:')) ->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0) ->setDecorators(array('ViewHelper')); if ($disable_all) { @@ -54,7 +54,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($enable); $type = new Zend_Form_Element_Select('type'); - $type->setLabel("Stream Type:") + $type->setLabel(_("Stream Type:")) ->setMultiOptions($stream_types) ->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0) ->setDecorators(array('ViewHelper')); @@ -64,7 +64,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($type); $bitrate = new Zend_Form_Element_Select('bitrate'); - $bitrate->setLabel("Bit Rate:") + $bitrate->setLabel(_("Bit Rate:")) ->setMultiOptions($stream_bitrates) ->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0) ->setDecorators(array('ViewHelper')); @@ -74,7 +74,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($bitrate); $output = new Zend_Form_Element_Select('output'); - $output->setLabel("Service Type:") + $output->setLabel(_("Service Type:")) ->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"SHOUTcast")) ->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast") ->setDecorators(array('ViewHelper')); @@ -84,8 +84,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($output); $channels = new Zend_Form_Element_Select('channels'); - $channels->setLabel("Channels:") - ->setMultiOptions(array("mono"=>"1 - Mono", "stereo"=>"2 - Stereo")) + $channels->setLabel(_("Channels:")) + ->setMultiOptions(array("mono"=>_("1 - Mono"), "stereo"=>_("2 - Stereo"))) ->setValue(isset($setting[$prefix.'_channels']) ? $setting[$prefix.'_channels'] : "stereo") ->setDecorators(array('ViewHelper')); if ($disable_all) { @@ -94,10 +94,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($channels); $host = new Zend_Form_Element_Text('host'); - $host->setLabel("Server") + $host->setLabel(_("Server")) ->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"") ->setValidators(array( - array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); if ($disable_all) { $host->setAttrib("disabled", "disabled"); @@ -106,10 +106,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($host); $port = new Zend_Form_Element_Text('port'); - $port->setLabel("Port") + $port->setLabel(_("Port")) ->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"") ->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999)))) - ->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.'))) + ->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.')))) ->setDecorators(array('ViewHelper')); if ($disable_all) { $port->setAttrib("disabled", "disabled"); @@ -117,10 +117,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($port); $pass = new Zend_Form_Element_Text('pass'); - $pass->setLabel("Password") + $pass->setLabel(_("Password")) ->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"") ->setValidators(array( - array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); if ($disable_all) { $pass->setAttrib("disabled", "disabled"); @@ -129,7 +129,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($pass); $genre = new Zend_Form_Element_Text('genre'); - $genre->setLabel("Genre") + $genre->setLabel(_("Genre")) ->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"") ->setDecorators(array('ViewHelper')); if ($disable_all) { @@ -138,10 +138,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($genre); $url = new Zend_Form_Element_Text('url'); - $url->setLabel("URL") + $url->setLabel(_("URL")) ->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"") ->setValidators(array( - array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); if ($disable_all) { $url->setAttrib("disabled", "disabled"); @@ -150,7 +150,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($url); $name = new Zend_Form_Element_Text('name'); - $name->setLabel("Name") + $name->setLabel(_("Name")) ->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"") ->setDecorators(array('ViewHelper')); if ($disable_all) { @@ -159,7 +159,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($name); $description = new Zend_Form_Element_Text('description'); - $description->setLabel("Description") + $description->setLabel(_("Description")) ->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"") ->setDecorators(array('ViewHelper')); if ($disable_all) { @@ -168,10 +168,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($description); $mount = new Zend_Form_Element_Text('mount'); - $mount->setLabel("Mount Point") + $mount->setLabel(_("Mount Point")) ->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"") ->setValidators(array( - array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); if ($disable_all) { $mount->setAttrib("disabled", "disabled"); @@ -180,18 +180,42 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $this->addElement($mount); $user = new Zend_Form_Element_Text('user'); - $user->setLabel("Username") + $user->setLabel(_("Username")) ->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"") ->setValidators(array( - array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) + array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) ->setDecorators(array('ViewHelper')); if ($disable_all) { $user->setAttrib("disabled", "disabled"); } $user->setAttrib('alt', 'regular_text'); $this->addElement($user); + + $adminUser = new Zend_Form_Element_Text('admin_user'); + $adminUser->setLabel(_("Admin User")) + ->setValue(Application_Model_StreamSetting::getAdminUser($prefix)) + ->setValidators(array( + array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) + ->setDecorators(array('ViewHelper')); + if ($disable_all) { + $adminUser->setAttrib("disabled", "disabled"); + } + $adminUser->setAttrib('alt', 'regular_text'); + $this->addElement($adminUser); + + $adminPass = new Zend_Form_Element_Text('admin_pass'); + $adminPass->setLabel(_("Admin Password")) + ->setValue(Application_Model_StreamSetting::getAdminPass($prefix)) + ->setValidators(array( + array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered'))))) + ->setDecorators(array('ViewHelper')); + if ($disable_all) { + $adminPass->setAttrib("disabled", "disabled"); + } + $adminPass->setAttrib('alt', 'regular_text'); + $this->addElement($adminPass); - $liquidsopa_error_msg = '

Getting information from the server...

'; + $liquidsopa_error_msg = '

'._('Getting information from the server...').'

'; $this->setDecorators(array( array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg)) @@ -205,18 +229,18 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm if ($f_data['enable'] == 1) { if ($f_data['host'] == '') { $element = $this->getElement("host"); - $element->addError("Server cannot be empty."); + $element->addError(_("Server cannot be empty.")); $isValid = false; } if ($f_data['port'] == '') { $element = $this->getElement("port"); - $element->addError("Port cannot be empty."); + $element->addError(_("Port cannot be empty.")); $isValid = false; } if ($f_data['output'] == 'icecast') { if ($f_data['mount'] == '') { $element = $this->getElement("mount"); - $element->addError("Mount cannot be empty with Icecast server."); + $element->addError(_("Mount cannot be empty with Icecast server.")); $isValid = false; } } diff --git a/airtime_mvc/application/forms/SupportSettings.php b/airtime_mvc/application/forms/SupportSettings.php index 827b9013b..660c7e6be 100644 --- a/airtime_mvc/application/forms/SupportSettings.php +++ b/airtime_mvc/application/forms/SupportSettings.php @@ -7,6 +7,7 @@ class Application_Form_SupportSettings extends Zend_Form public function init() { $country_list = Application_Model_Preference::GetCountryList(); + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); $this->setDecorators(array( array('ViewScript', array('viewScript' => 'form/support-setting.phtml')), @@ -16,10 +17,10 @@ class Application_Form_SupportSettings extends Zend_Form //Station name $this->addElement('text', 'stationName', array( 'class' => 'input_text', - 'label' => 'Station Name', + 'label' => _('Station Name'), 'required' => true, 'filters' => array('StringTrim'), - 'validator' => array('NotEmpty'), + 'validators' => array($notEmptyValidator), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array( 'ViewHelper' @@ -29,7 +30,7 @@ class Application_Form_SupportSettings extends Zend_Form // Phone number $this->addElement('text', 'Phone', array( 'class' => 'input_text', - 'label' => 'Phone:', + 'label' => _('Phone:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), @@ -41,7 +42,7 @@ class Application_Form_SupportSettings extends Zend_Form //Email $this->addElement('text', 'Email', array( 'class' => 'input_text', - 'label' => 'Email:', + 'label' => _('Email:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), @@ -52,7 +53,7 @@ class Application_Form_SupportSettings extends Zend_Form // Station Web Site $this->addElement('text', 'StationWebSite', array( - 'label' => 'Station Web Site:', + 'label' => _('Station Web Site:'), 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationWebSite(), @@ -63,7 +64,7 @@ class Application_Form_SupportSettings extends Zend_Form // county list dropdown $this->addElement('select', 'Country', array( - 'label' => 'Country:', + 'label' => _('Country:'), 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, @@ -74,7 +75,7 @@ class Application_Form_SupportSettings extends Zend_Form // Station city $this->addElement('text', 'City', array( - 'label' => 'City:', + 'label' => _('City:'), 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), @@ -86,7 +87,7 @@ class Application_Form_SupportSettings extends Zend_Form // Station Description $description = new Zend_Form_Element_Textarea('Description'); $description->class = 'input_text_area'; - $description->setLabel('Station Description:') + $description->setLabel(_('Station Description:')) ->setRequired(false) ->setValue(Application_Model_Preference::GetStationDescription()) ->setDecorators(array('ViewHelper')) @@ -96,7 +97,7 @@ class Application_Form_SupportSettings extends Zend_Form // Station Logo $upload = new Zend_Form_Element_File('Logo'); - $upload->setLabel('Station Logo:') + $upload->setLabel(_('Station Logo:')) ->setRequired(false) ->setDecorators(array('File')) ->addValidator('Count', false, 1) @@ -107,7 +108,7 @@ class Application_Form_SupportSettings extends Zend_Form //enable support feedback $this->addElement('checkbox', 'SupportFeedback', array( - 'label' => 'Send support feedback', + 'label' => _('Send support feedback'), 'required' => false, 'value' => Application_Model_Preference::GetSupportFeedback(), 'decorators' => array( @@ -117,7 +118,7 @@ class Application_Form_SupportSettings extends Zend_Form // checkbox for publicise $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); - $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org') + $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org')) ->setRequired(false) ->setDecorators(array('ViewHelper')) ->setValue(Application_Model_Preference::GetPublicise()); @@ -128,15 +129,18 @@ class Application_Form_SupportSettings extends Zend_Form // checkbox for privacy policy $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); - $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's privacy policy.") + $checkboxPrivacy->setLabel( + sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."), + "", + "")) ->setDecorators(array('ViewHelper')); $this->addElement($checkboxPrivacy); // submit button $submit = new Zend_Form_Element_Submit("submit"); - $submit->class = 'ui-button ui-state-default right-floated'; + $submit->class = 'btn right-floated'; $submit->setIgnore(true) - ->setLabel("Save") + ->setLabel(_("Save")) ->setDecorators(array('ViewHelper')); $this->addElement($submit); } @@ -145,13 +149,13 @@ class Application_Form_SupportSettings extends Zend_Form public function isValid ($data) { $isValid = parent::isValid($data); - if (isset($data["Privacy"])) { - $checkPrivacy = $this->getElement('Privacy'); - if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") { - $checkPrivacy->addError("You have to agree to privacy policy."); - $isValid = false; - } + if (isset($data["Privacy"])) { + $checkPrivacy = $this->getElement('Privacy'); + if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") { + $checkPrivacy->addError(_("You have to agree to privacy policy.")); + $isValid = false; } + } return $isValid; } diff --git a/airtime_mvc/application/forms/WatchedDirPreferences.php b/airtime_mvc/application/forms/WatchedDirPreferences.php index 7fcf00893..7c4fca1c8 100644 --- a/airtime_mvc/application/forms/WatchedDirPreferences.php +++ b/airtime_mvc/application/forms/WatchedDirPreferences.php @@ -11,7 +11,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm $this->addElement('text', 'storageFolder', array( 'class' => 'input_text', - 'label' => 'Import Folder:', + 'label' => _('Import Folder:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => '', @@ -22,7 +22,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm $this->addElement('text', 'watchedFolder', array( 'class' => 'input_text', - 'label' => 'Watched Folders:', + 'label' => _('Watched Folders:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => '', @@ -37,7 +37,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm $element = $this->getElement($p_form_element_id); if (!is_dir($element->getValue())) { - $element->setErrors(array('Not a valid Directory')); + $element->setErrors(array(_('Not a valid Directory'))); return false; } else { diff --git a/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php b/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php index bd3ae5723..d0d1992fc 100644 --- a/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php +++ b/airtime_mvc/application/forms/customvalidators/ConditionalNotEmpty.php @@ -7,9 +7,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract { const KEY_IS_EMPTY = 'keyIsEmpty'; - protected $_messageTemplates = array( - self::KEY_IS_EMPTY => 'Value is required and can\'t be empty' - ); + protected $_messageTemplates; protected $_fieldValues; @@ -24,6 +22,9 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract public function __construct($fieldValues) { $this->_fieldValues = $fieldValues; + $this->_messageTemplates = array( + self::KEY_IS_EMPTY => _("Value is required and can't be empty") + ); } /** diff --git a/airtime_mvc/application/forms/helpers/ValidationTypes.php b/airtime_mvc/application/forms/helpers/ValidationTypes.php new file mode 100644 index 000000000..9f50e25b5 --- /dev/null +++ b/airtime_mvc/application/forms/helpers/ValidationTypes.php @@ -0,0 +1,96 @@ +setMessage( + _("Value is required and can't be empty"), + Zend_Validate_NotEmpty::IS_EMPTY + ); + + return $validator; + } + + public static function overrideEmailAddressValidator() + { + $validator = new Zend_Validate_EmailAddress(); + $validator->setMessage( + _("'%value%' is no valid email address in the basic format local-part@hostname"), + Zend_Validate_EmailAddress::INVALID_FORMAT + ); + + return $validator; + } + + public static function overrrideDateValidator($p_format) + { + $validator = new Zend_Validate_Date(); + + $validator->setFormat($p_format); + + $validator->setMessage( + _("'%value%' does not fit the date format '%format%'"), + Zend_Validate_Date::FALSEFORMAT + ); + + return $validator; + } + + public static function overrideRegexValidator($p_pattern, $p_msg) + { + $validator = new Zend_Validate_Regex($p_pattern); + + $validator->setMessage( + $p_msg, + Zend_Validate_Regex::NOT_MATCH + ); + + return $validator; + } + + public static function overrideStringLengthValidator($p_min, $p_max) + { + $validator = new Zend_Validate_StringLength(); + $validator->setMin($p_min); + $validator->setMax($p_max); + + $validator->setMessage( + _("'%value%' is less than %min% characters long"), + Zend_Validate_StringLength::TOO_SHORT + ); + + $validator->setMessage( + _("'%value%' is more than %max% characters long"), + Zend_Validate_StringLength::TOO_LONG + ); + + return $validator; + } + + public static function overrideBetweenValidator($p_min, $p_max) + { + $validator = new Zend_Validate_Between($p_min, $p_max, true); + + $validator->setMessage( + _("'%value%' is not between '%min%' and '%max%', inclusively"), + Zend_Validate_Between::NOT_BETWEEN + ); + + return $validator; + } + + public static function overridePasswordIdenticalValidator($p_matchAgainst) + { + $validator = new Zend_Validate_Identical(); + $validator->setToken($p_matchAgainst); + + $validator->setMessage( + _("Passwords do not match"), + Zend_Validate_Identical::NOT_SAME + ); + + return $validator; + } + +} \ No newline at end of file diff --git a/airtime_mvc/application/layouts/scripts/audio-player.phtml b/airtime_mvc/application/layouts/scripts/audio-player.phtml index 85f5a7166..f4ce75a59 100644 --- a/airtime_mvc/application/layouts/scripts/audio-player.phtml +++ b/airtime_mvc/application/layouts/scripts/audio-player.phtml @@ -2,9 +2,9 @@ - Audio Player - headScript() ?> + <?php echo _("Audio Player")?> headLink() ?> + headScript() ?> google_analytics)?$this->google_analytics:"" ?> diff --git a/airtime_mvc/application/layouts/scripts/bare.phtml b/airtime_mvc/application/layouts/scripts/bare.phtml index b89443505..f6b3f99bf 100644 --- a/airtime_mvc/application/layouts/scripts/bare.phtml +++ b/airtime_mvc/application/layouts/scripts/bare.phtml @@ -2,9 +2,9 @@ - Live stream - headScript() ?> + <?php echo _("Live stream") ?> headLink() ?> + headScript() ?> google_analytics)?$this->google_analytics:"" ?> diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml index de43830b4..29d04c0d6 100644 --- a/airtime_mvc/application/layouts/scripts/layout.phtml +++ b/airtime_mvc/application/layouts/scripts/layout.phtml @@ -3,9 +3,10 @@ headTitle() ?> - headScript() ?> headLink() ?> + headScript() ?> google_analytics)?$this->google_analytics:"" ?> + @@ -22,7 +23,9 @@ $this->navigation()->menu()->setPartial($partial); ?>
diff --git a/airtime_mvc/application/layouts/scripts/login.phtml b/airtime_mvc/application/layouts/scripts/login.phtml index 42389f11a..e1e4167a2 100644 --- a/airtime_mvc/application/layouts/scripts/login.phtml +++ b/airtime_mvc/application/layouts/scripts/login.phtml @@ -3,8 +3,8 @@ headTitle() ?> - headScript() ?> headLink() ?> + headScript() ?> google_analytics)?$this->google_analytics:"" ?> @@ -13,8 +13,9 @@ layout()->content ?> diff --git a/airtime_mvc/application/models/Auth.php b/airtime_mvc/application/models/Auth.php index 2aef1ce81..104ee8050 100644 --- a/airtime_mvc/application/models/Auth.php +++ b/airtime_mvc/application/models/Auth.php @@ -30,10 +30,10 @@ class Application_Model_Auth $e_link_port = $_SERVER['SERVER_PORT']; $e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change'); - $message = "Hi {$user->getDbLogin()}, \n\nClick this link to reset your password: "; + $message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin()); $message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}"; - $success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail()); + $success = Application_Model_Email::send(_('Airtime Password Reset'), $message, $user->getDbEmail()); return $success; } diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index e6dd311f8..8f285e86a 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -395,12 +395,13 @@ SQL; { $file = CcFilesQuery::create()->findPK($p_item, $this->con); - if (isset($file) && $file->getDbFileExists()) { + if (isset($file) && $file->visible()) { $entry = $this->blockItem; $entry["id"] = $file->getDbId(); $entry["pos"] = $pos; $entry["cliplength"] = $file->getDbLength(); - $entry["cueout"] = $file->getDbLength(); + $entry["cueout"] = $file->getDbCueout(); + $entry["cuein"] = $file->getDbCuein(); return $entry; } else { @@ -410,11 +411,7 @@ SQL; public function isStatic() { - if ($this->block->getDbType() == "static") { - return true; - } else { - return false; - } + return $this->block->getDbType() == "static"; } /* @@ -760,7 +757,7 @@ SQL; try { if (is_null($cueIn) && is_null($cueOut)) { - $errArray["error"] = "Cue in and cue out are null."; + $errArray["error"] = _("Cue in and cue out are null."); return $errArray; } @@ -795,7 +792,7 @@ SQL; ); $result = Application_Common_Database::prepareAndExecute($sql, $params, 'column'); if ($result) { - $errArray["error"] = "Can't set cue out to be greater than file length."; + $errArray["error"] = _("Can't set cue out to be greater than file length."); return $errArray; } @@ -806,7 +803,7 @@ SQL; ); $result = Application_Common_Database::prepareAndExecute($sql, $params, 'column'); if ($result) { - $errArray["error"] = "Can't set cue in to be larger than cue out."; + $errArray["error"] = _("Can't set cue in to be larger than cue out."); return $errArray; } @@ -827,7 +824,7 @@ SQL; ); $result = Application_Common_Database::prepareAndExecute($sql, $params, 'column'); if ($result) { - $errArray["error"] = "Can't set cue in to be larger than cue out."; + $errArray["error"] = _("Can't set cue in to be larger than cue out."); return $errArray; } @@ -851,7 +848,7 @@ SQL; ); $result = Application_Common_Database::prepareAndExecute($sql, $params, 'column'); if ($result) { - $errArray["error"] = "Can't set cue out to be greater than file length."; + $errArray["error"] = _("Can't set cue out to be greater than file length."); return $errArray; } @@ -862,7 +859,7 @@ SQL; ); $result = Application_Common_Database::prepareAndExecute($sql, $params, 'column'); if ($result) { - $errArray["error"] = "Can't set cue out to be smaller than cue in."; + $errArray["error"] = _("Can't set cue out to be smaller than cue in."); return $errArray; } @@ -943,9 +940,8 @@ SQL; public static function getBlockCount() { - global $CC_CONFIG; $con = Propel::getConnection(); - $sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"]; + $sql = 'SELECT count(*) as cnt FROM cc_playlist'; return $con->query($sql)->fetchColumn(0); } @@ -1210,32 +1206,32 @@ SQL; public function getCriteria() { $criteriaOptions = array( - 0 => "Select criteria", - "album_title" => "Album", - "bit_rate" => "Bit Rate (Kbps)", - "bpm" => "BPM", - "composer" => "Composer", - "conductor" => "Conductor", - "copyright" => "Copyright", - "artist_name" => "Creator", - "encoded_by" => "Encoded By", - "genre" => "Genre", - "isrc_number" => "ISRC", - "label" => "Label", - "language" => "Language", - "mtime" => "Last Modified", - "lptime" => "Last Played", - "length" => "Length", - "mime" => "Mime", - "mood" => "Mood", - "owner_id" => "Owner", - "replay_gain" => "Replay Gain", - "sample_rate" => "Sample Rate (kHz)", - "track_title" => "Title", - "track_number" => "Track Number", - "utime" => "Uploaded", - "info_url" => "Website", - "year" => "Year" + 0 => _("Select criteria"), + "album_title" => _("Album"), + "bit_rate" => _("Bit Rate (Kbps)"), + "bpm" => _("BPM"), + "composer" => _("Composer"), + "conductor" => _("Conductor"), + "copyright" => _("Copyright"), + "artist_name" => _("Creator"), + "encoded_by" => _("Encoded By"), + "genre" => _("Genre"), + "isrc_number" => _("ISRC"), + "label" => _("Label"), + "language" => _("Language"), + "mtime" => _("Last Modified"), + "lptime" => _("Last Played"), + "length" => _("Length"), + "mime" => _("Mime"), + "mood" => _("Mood"), + "owner_id" => _("Owner"), + "replay_gain" => _("Replay Gain"), + "sample_rate" => _("Sample Rate (kHz)"), + "track_title" => _("Title"), + "track_number" => _("Track Number"), + "utime" => _("Uploaded"), + "info_url" => _("Website"), + "year" => _("Year") ); // Load criteria from db @@ -1363,6 +1359,7 @@ SQL; // check if file exists $qry->add("file_exists", "true", Criteria::EQUAL); + $qry->add("hidden", "false", Criteria::EQUAL); $qry->addAscendingOrderByColumn('random()'); } // construct limit restriction diff --git a/airtime_mvc/application/models/Locale.php b/airtime_mvc/application/models/Locale.php new file mode 100644 index 000000000..43cde2568 --- /dev/null +++ b/airtime_mvc/application/models/Locale.php @@ -0,0 +1,35 @@ +query($sql)->fetchAll(); + $out = array(); + foreach ($res as $r) { + $out[$r["locale_code"]] = $r["locale_lang"]; + } + + return $out; + } + + public static function configureLocalization($locale = null) + { + $codeset = 'UTF-8'; + if (is_null($locale)) { + $lang = Application_Model_Preference::GetLocale().'.'.$codeset; + } else { + $lang = $locale.'.'.$codeset; + } + putenv("LC_ALL=$lang"); + putenv("LANG=$lang"); + $res = setlocale(LC_MESSAGES, $lang); + + $domain = 'airtime'; + bindtextdomain($domain, '/usr/share/airtime/locale'); + textdomain($domain); + bind_textdomain_codeset($domain, $codeset); + } +} \ No newline at end of file diff --git a/airtime_mvc/application/models/MusicDir.php b/airtime_mvc/application/models/MusicDir.php index 3d28f2e75..117d06f40 100644 --- a/airtime_mvc/application/models/MusicDir.php +++ b/airtime_mvc/application/models/MusicDir.php @@ -157,15 +157,15 @@ SQL; $diff = strlen($dir) - strlen($p_path); if ($diff == 0) { if ($dir == $p_path) { - throw new NestedDirectoryException("'$p_path' is already watched."); + throw new NestedDirectoryException(sprintf(_("%s is already watched."), $p_path)); } } elseif ($diff > 0) { if (self::isAncestorDir($p_path, $dir)) { - throw new NestedDirectoryException("'$p_path' contains nested watched directory: '$dir'"); + throw new NestedDirectoryException(sprintf(_("%s contains nested watched directory: %s"), $p_path, $dir)); } } else { /* diff < 0*/ if (self::isAncestorDir($dir, $p_path)) { - throw new NestedDirectoryException("'$p_path' is nested within existing watched directory: '$dir'"); + throw new NestedDirectoryException(sprintf(_("%s is nested within existing watched directory: %s"), $p_path, $dir)); } } } @@ -186,7 +186,7 @@ SQL; public static function addDir($p_path, $p_type, $userAddedWatchedDir=true, $nestedWatch=false) { if (!is_dir($p_path)) { - return array("code"=>2, "error"=>"'$p_path' is not a valid directory."); + return array("code"=>2, "error"=>sprintf(_("%s is not a valid directory."), $p_path)); } $real_path = Application_Common_OsPath::normpath($p_path)."/"; if ($real_path != "/") { @@ -227,7 +227,8 @@ SQL; 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"); + return array("code"=>1, + "error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list"), $p_path)); } } @@ -246,50 +247,49 @@ SQL; { $res = self::addDir($p_path, "watched", $userAddedWatchedDir, $nestedWatch); - if ($res['code'] == 0) { + if ($res['code'] != 0) { return $res; } - //convert "linked" files (Airtime <= 1.8.2) to watched files. - $propel_link_dir = CcMusicDirsQuery::create() - ->filterByType('link') + //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(Application_Common_OsPath::normpath($p_path)."/") ->findOne(); - //see if any linked files exist. - if (isset($propel_link_dir)) { + //any files of the deprecated "link" type. + $link_files = CcFilesQuery::create() + ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) + ->filterByDbDirectory($propel_link_dir->getId()) + ->find(); - //newly added watched directory object - $propel_new_watch = CcMusicDirsQuery::create() - ->filterByDirectory(Application_Common_OsPath::normpath($p_path)."/") - ->findOne(); + $newly_watched_dir = $propel_new_watch->getDirectory(); - //any files of the deprecated "link" type. - $link_files = CcFilesQuery::create() - ->setFormatter(ModelCriteria::FORMAT_ON_DEMAND) - ->filterByDbDirectory($propel_link_dir->getId()) - ->find(); + foreach ($link_files as $link_file) { + $link_filepath = $link_file->getDbFilepath(); - $newly_watched_dir = $propel_new_watch->getDirectory(); + //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)) { - foreach ($link_files as $link_file) { - $link_filepath = $link_file->getDbFilepath(); + //get the filepath path not including the watched directory. + $sub_link_filepath = substr($link_filepath, strlen($newly_watched_dir)); - //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(); - } + $link_file->setDbDirectory($propel_new_watch->getId()); + $link_file->setDbFilepath($sub_link_filepath); + $link_file->save(); } } - - $data = array(); - $data["directory"] = $p_path; - Application_Model_RabbitMq::SendMessageToMediaMonitor("new_watch", $data); } + $data = array(); + $data["directory"] = $p_path; + Application_Model_RabbitMq::SendMessageToMediaMonitor("new_watch", $data); + return $res; } @@ -360,7 +360,7 @@ SQL; // path should always ends with trailing '/' $p_dir = Application_Common_OsPath::normpath($p_dir)."/"; if (!is_dir($p_dir)) { - return array("code"=>2, "error"=>"'$p_dir' is not a valid directory."); + return array("code"=>2, "error"=>sprintf(_("%s is not a valid directory."), $p_dir)); } elseif (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."); } @@ -377,7 +377,8 @@ SQL; 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."); + return array("code"=>1, + "error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list."), $p_dir)); } } @@ -420,7 +421,7 @@ SQL; } $dir = Application_Model_MusicDir::getDirByPath($p_dir); if (is_null($dir)) { - return array("code"=>1, "error"=>"'$p_dir' doesn't exist in the watched list."); + return array("code"=>1, "error"=>sprintf(_("%s doesn't exist in the watched list."), $p_dir)); } else { $dir->remove($userAddedWatchedDir); $data = array(); @@ -445,4 +446,16 @@ SQL; return array($mus_dir->getDirectory(), trim($fp)); } + + public function unhideFiles() + { + $files = $this->_dir->getCcFiless(); + $hid = 0; + foreach ($files as $file) { + $hid++; + $file->setDbHidden(false); + $file->save(); + } + Logging::info("unhide '$hid' files"); + } } diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index f70012b73..2cd0050ab 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -387,13 +387,19 @@ SQL; } if (isset($obj)) { - if (($obj instanceof CcFiles && $obj->getDbFileExists()) || $obj instanceof CcWebstream || $obj instanceof CcBlock) { - $entry = $this->plItem; - $entry["id"] = $obj->getDbId(); - $entry["pos"] = $pos; + if (($obj instanceof CcFiles && $obj->visible()) + || $obj instanceof CcWebstream || + $obj instanceof CcBlock) { + + $entry = $this->plItem; + $entry["id"] = $obj->getDbId(); + $entry["pos"] = $pos; $entry["cliplength"] = $obj->getDbLength(); - $entry["cueout"] = $obj->getDbLength(); - $entry["ftype"] = $objType; + if ($obj instanceof CcFiles && $obj) { + $entry["cuein"] = $obj->getDbCuein(); + $entry["cueout"] = $obj->getDbCueout(); + } + $entry["ftype"] = $objType; } return $entry; @@ -632,7 +638,7 @@ SQL; //setting it to nonNull for checks down below $fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn; $fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut; - + $this->con->beginTransaction(); try { @@ -643,7 +649,6 @@ SQL; } $clipLength = $row->getDbCliplength(); - if (!is_null($fadeIn)) { $sql = "SELECT :fadein::INTERVAL > INTERVAL '{$clipLength}'"; @@ -662,11 +667,9 @@ SQL; } $row->setDbFadeout($fadeOut); } - - $row->save($this->con); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC"))); $this->pl->save($this->con); - + $this->con->commit(); } catch (Exception $e) { $this->con->rollback(); @@ -687,7 +690,6 @@ SQL; $this->changeFadeInfo($row->getDbId(), $fadein, null); } - if (isset($fadeout)) { Logging::info("Setting playlist fade out {$fadeout}"); $row = CcPlaylistcontentsQuery::create() @@ -718,7 +720,7 @@ SQL; try { if (is_null($cueIn) && is_null($cueOut)) { - $errArray["error"] = "Cue in and cue out are null."; + $errArray["error"] = _("Cue in and cue out are null."); return $errArray; } @@ -748,14 +750,14 @@ SQL; $sql = "SELECT :cueIn::INTERVAL > :cueOut::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':cueOut'=>$cueOut), 'column')) { - $errArray["error"] = "Can't set cue in to be larger than cue out."; + $errArray["error"] = _("Can't set cue in to be larger than cue out."); return $errArray; } $sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) { - $errArray["error"] = "Can't set cue out to be greater than file length."; + $errArray["error"] = _("Can't set cue out to be greater than file length."); return $errArray; } @@ -771,7 +773,7 @@ SQL; $sql = "SELECT :cueIn::INTERVAL > :oldCueOut::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut), 'column')) { - $errArray["error"] = "Can't set cue in to be larger than cue out."; + $errArray["error"] = _("Can't set cue in to be larger than cue out."); return $errArray; } @@ -789,14 +791,14 @@ SQL; $sql = "SELECT :cueOut::INTERVAL < :oldCueIn::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn), 'column')) { - $errArray["error"] = "Can't set cue out to be smaller than cue in."; + $errArray["error"] = _("Can't set cue out to be smaller than cue in."); return $errArray; } $sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) { - $errArray["error"] = "Can't set cue out to be greater than file length."; + $errArray["error"] = _("Can't set cue out to be greater than file length."); return $errArray; } @@ -867,9 +869,8 @@ SQL; public static function getPlaylistCount() { - global $CC_CONFIG; $con = Propel::getConnection(); - $sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"]; + $sql = 'SELECT count(*) as cnt FROM cc_playlist'; return $con->query($sql)->fetchColumn(0); } @@ -930,6 +931,29 @@ SQL; { CcPlaylistcontentsQuery::create()->findByDbPlaylistId($this->id)->delete(); } + + public function shuffle() + { + $sql = <<$this->id)); + $maxPosition = $out[0]['max']; + + $map = range(0, $maxPosition); + shuffle($map); + + $currentPos = implode(',', array_keys($map)); + $sql = "UPDATE cc_playlistcontents SET position = CASE position "; + foreach ($map as $current => $after) { + $sql .= sprintf("WHEN %d THEN %d ", $current, $after); + } + $sql .= "END WHERE position IN ($currentPos) and playlist_id=:p1"; + + Application_Common_Database::prepareAndExecute($sql, array("p1"=>$this->id)); + $result['result'] = 0; + return $result; + } } // class Playlist diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 1a4139119..981e7dc47 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -3,7 +3,12 @@ class Application_Model_Preference { - private static function setValue($key, $value, $isUserValue = false) + /** + * + * @param integer $userId is not null when we are setting a locale for a specific user + * @param boolean $isUserValue is true when we are setting a value for the current user + */ + private static function setValue($key, $value, $isUserValue = false, $userId = null) { try { //called from a daemon process @@ -22,9 +27,12 @@ class Application_Model_Preference $paramMap[':key'] = $key; //For user specific preference, check if id matches as well - if ($isUserValue) { + if ($isUserValue && is_null($userId)) { $sql .= " AND subjid = :id"; $paramMap[':id'] = $id; + } else if (!is_null($userId)) { + $sql .= " AND subjid= :id"; + $paramMap[':id'] = $userId; } $result = Application_Common_Database::prepareAndExecute($sql, $paramMap, 'column'); @@ -42,7 +50,11 @@ class Application_Model_Preference $sql = "UPDATE cc_pref" . " SET valstr = :value" . " WHERE keystr = :key AND subjid = :id"; - $paramMap[':id'] = $id; + if (is_null($userId)) { + $paramMap[':id'] = $id; + } else { + $paramMap[':id'] = $userId; + } } } else { // result not found @@ -54,7 +66,11 @@ class Application_Model_Preference // user pref $sql = "INSERT INTO cc_pref (subjid, keystr, valstr)" ." VALUES (:id, :key, :value)"; - $paramMap[':id'] = $id; + if (is_null($userId)) { + $paramMap[':id'] = $id; + } else { + $paramMap[':id'] = $userId; + } } } $paramMap[':key'] = $key; @@ -418,17 +434,80 @@ class Application_Model_Preference return self::getValue("description"); } - public static function SetTimezone($timezone) + public static function SetDefaultTimezone($timezone) { self::setValue("timezone", $timezone); date_default_timezone_set($timezone); } - public static function GetTimezone() + public static function GetDefaultTimezone() { return self::getValue("timezone"); } + public static function SetUserTimezone($userId, $timezone = null) + { + // When a new user is created they will get the default timezone + // setting which the admin sets on preferences page + if (is_null($timezone)) { + $timezone = self::GetDefaultTimezone(); + } + self::setValue("user_timezone", $timezone, true, $userId); + } + + public static function GetUserTimezone($id) + { + return self::getValue("user_timezone", true); + } + + public static function GetTimezone() + { + $auth = Zend_Auth::getInstance(); + if ($auth->hasIdentity()) { + $id = $auth->getIdentity()->id; + return self::GetUserTimezone($id); + } else { + return self::GetDefaultTimezone(); + } + } + + // This is the language setting on preferences page + public static function SetDefaultLocale($locale) + { + self::setValue("locale", $locale); + } + + public static function GetDefaultLocale() + { + return self::getValue("locale"); + } + + public static function GetUserLocale($id) + { + return self::getValue("user_locale", true); + } + + public static function SetUserLocale($userId, $locale = null) + { + // When a new user is created they will get the default locale + // setting which the admin sets on preferences page + if (is_null($locale)) { + $locale = self::GetDefaultLocale(); + } + self::setValue("user_locale", $locale, true, $userId); + } + + public static function GetLocale() + { + $auth = Zend_Auth::getInstance(); + if ($auth->hasIdentity()) { + $id = $auth->getIdentity()->id; + return self::GetUserLocale($id); + } else { + return self::GetDefaultLocale(); + } + } + public static function SetStationLogo($imagePath) { if (!empty($imagePath)) { @@ -456,7 +535,7 @@ class Application_Model_Preference $sql = "SELECT * FROM cc_country"; $res = $con->query($sql)->fetchAll(); $out = array(); - $out[""] = "Select Country"; + $out[""] = _("Select Country"); foreach ($res as $r) { $out[$r["isocode"]] = $r["name"]; } @@ -500,6 +579,7 @@ class Application_Model_Preference } else { $outputArray['NUM_SOUNDCLOUD_TRACKS_UPLOADED'] = NULL; } + $outputArray['STATION_NAME'] = self::GetStationName(); $outputArray['PHONE'] = self::GetPhone(); $outputArray['EMAIL'] = self::GetEmail(); @@ -513,7 +593,7 @@ class Application_Model_Preference $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]; } @@ -1166,4 +1246,27 @@ class Application_Model_Preference $data = self::getValue("nowplaying_screen", true); return ($data != "") ? unserialize($data) : null; } + + public static function SetEnableReplayGain($value) { + self::setValue("enable_replay_gain", $value, false); + } + + public static function GetEnableReplayGain() { + return self::getValue("enable_replay_gain", false); + } + + public static function getReplayGainModifier(){ + $rg_modifier = self::getValue("replay_gain_modifier"); + + if ($rg_modifier === "") { + return "0"; + } + + return $rg_modifier; + } + + public static function setReplayGainModifier($rg_modifier) + { + self::setValue("replay_gain_modifier", $rg_modifier, true); + } } diff --git a/airtime_mvc/application/models/RabbitMq.php b/airtime_mvc/application/models/RabbitMq.php index 7fea88348..df3ffca29 100644 --- a/airtime_mvc/application/models/RabbitMq.php +++ b/airtime_mvc/application/models/RabbitMq.php @@ -15,7 +15,7 @@ class Application_Model_RabbitMq private static function sendMessage($exchange, $data) { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"], $CC_CONFIG["rabbitmq"]["port"], diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 48aeeb4fc..09f66cd99 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -181,15 +181,14 @@ SQL; public static function GetLastScheduleItem($p_timeNow) { - global $CC_CONFIG; $sql = << TIMESTAMP :timeNow" ." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows. @@ -260,7 +257,6 @@ SQL; */ public static function GetScheduleDetailItems($p_start, $p_end, $p_shows) { - global $CC_CONFIG; $con = Propel::getConnection(); $p_start_str = $p_start->format("Y-m-d H:i:s"); @@ -386,9 +382,8 @@ SQL; public static function UpdateMediaPlayedStatus($p_id) { - global $CC_CONFIG; $con = Propel::getConnection(); - $sql = "UPDATE ".$CC_CONFIG['scheduleTable'] + $sql = "UPDATE cc_schedule" ." SET media_item_played=TRUE"; // we need to update 'broadcasted' column as well // check the current switch status @@ -427,9 +422,8 @@ SQL; public static function getSchduledPlaylistCount() { - global $CC_CONFIG; $con = Propel::getConnection(); - $sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['scheduleTable']; + $sql = "SELECT count(*) as cnt FROM cc_schedule"; return $con->query($sql)->fetchColumn(0); } @@ -680,6 +674,13 @@ SQL; $same_hour = $start_hour == $end_hour; $independent_event = !$same_hour; + $replay_gain = is_null($item["replay_gain"]) ? "0": $item["replay_gain"]; + $replay_gain += Application_Model_Preference::getReplayGainModifier(); + + if ( !Application_Model_Preference::GetEnableReplayGain() ) { + $replay_gain = 0; + } + $schedule_item = array( 'id' => $media_id, 'type' => 'file', @@ -692,8 +693,8 @@ SQL; 'start' => $start, 'end' => $end, 'show_name' => $item["show_name"], - 'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"], - 'independent_event' => $independent_event, + 'replay_gain' => $replay_gain, + 'independent_event' => $independent_event, ); self::appendScheduleItem($data, $start, $schedule_item); } @@ -762,7 +763,7 @@ SQL; private static function getRangeStartAndEnd($p_fromDateTime, $p_toDateTime) { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); /* if $p_fromDateTime and $p_toDateTime function parameters are null, then set range * from "now" to "now + 24 hours". */ @@ -837,8 +838,8 @@ SQL; /* Check if two events are less than or equal to 1 second apart */ public static function areEventsLinked($event1, $event2) { - $dt1 = DateTime::createFromFormat("Y-m-d-H-i-s", $event1['start']); - $dt2 = DateTime::createFromFormat("Y-m-d-H-i-s", $event2['start']); + $dt1 = DateTime::createFromFormat("Y-m-d-H-i-s", $event1['start']); + $dt2 = DateTime::createFromFormat("Y-m-d-H-i-s", $event2['start']); $seconds = $dt2->getTimestamp() - $dt1->getTimestamp(); return $seconds <= 1; @@ -858,7 +859,7 @@ SQL; * * There's a special case here is well. When the back-to-back streams are the same, we * can collapse the instructions 1,2,(3,4,1,2),3,4 to 1,2,3,4. We basically cut out the - * middle part. This function handles this. + * middle part. This function handles this. */ private static function foldData(&$data) { @@ -911,15 +912,13 @@ SQL; public static function deleteAll() { - global $CC_CONFIG; $con = Propel::getConnection(); - $con->exec("TRUNCATE TABLE ".$CC_CONFIG["scheduleTable"]); + $con->exec("TRUNCATE TABLE cc_schedule"); } public static function deleteWithFileId($fileId) { - global $CC_CONFIG; - $sql = "DELETE FROM ".$CC_CONFIG["scheduleTable"]." WHERE file_id=:file_id"; + $sql = "DELETE FROM cc_schedule WHERE file_id=:file_id"; Application_Common_Database::prepareAndExecute($sql, array(':file_id'=>$fileId), 'execute'); } diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php index 80f7ded9e..18716f1e9 100644 --- a/airtime_mvc/application/models/Scheduler.php +++ b/airtime_mvc/application/models/Scheduler.php @@ -79,12 +79,12 @@ class Application_Model_Scheduler //an item has been deleted if (count($schedIds) !== count($schedItems)) { - throw new OutDatedScheduleException("The schedule you're viewing is out of date! (sched mismatch)"); + throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (sched mismatch)")); } //a show has been deleted if (count($instanceIds) !== count($showInstances)) { - throw new OutDatedScheduleException("The schedule you're viewing is out of date! (instance mismatch)"); + throw new OutDatedScheduleException(_("The schedule you're viewing is out of date! (instance mismatch)")); } foreach ($schedItems as $schedItem) { @@ -92,7 +92,7 @@ class Application_Model_Scheduler $instance = $schedItem->getCcShowInstances($this->con); if (intval($schedInfo[$id]) !== $instance->getDbId()) { - throw new OutDatedScheduleException("The schedule you're viewing is out of date!"); + throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!")); } } @@ -102,24 +102,24 @@ class Application_Model_Scheduler $show = $instance->getCcShow($this->con); if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) { - throw new Exception("You are not allowed to schedule show {$show->getDbName()}."); + throw new Exception(sprintf(_("You are not allowed to schedule show %s."), $show->getDbName())); } if ($instance->getDbRecord()) { - throw new Exception("You cannot add files to recording shows."); + throw new Exception(_("You cannot add files to recording shows.")); } $showEndEpoch = floatval($instance->getDbEnds("U.u")); if ($showEndEpoch < $nowEpoch) { - throw new OutDatedScheduleException("The show {$show->getDbName()} is over and cannot be scheduled."); + throw new OutDatedScheduleException(sprintf(_("The show %s is over and cannot be scheduled."), $show->getDbName())); } $ts = intval($instanceInfo[$id]); $lastSchedTs = intval($instance->getDbLastScheduled("U")) ? : 0; if ($ts < $lastSchedTs) { Logging::info("ts {$ts} last sched {$lastSchedTs}"); - throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!"); + throw new OutDatedScheduleException(sprintf(_("The show %s has been previously updated!"), $show->getDbName())); } } } @@ -137,13 +137,14 @@ class Application_Model_Scheduler if ($type === "audioclip") { $file = CcFilesQuery::create()->findPK($id, $this->con); - if (is_null($file) || !$file->getDbFileExists()) { - throw new Exception("A selected File does not exist!"); + if (is_null($file) || !$file->visible()) { + throw new Exception(_("A selected File does not exist!")); } else { $data = $this->fileInfo; $data["id"] = $id; $data["cliplength"] = $file->getDbLength(); - $data["cueout"] = $file->getDbLength(); + $data["cuein"] = $file->getDbCuein(); + $data["cueout"] = $file->getDbCueout(); $defaultFade = Application_Model_Preference::GetDefaultFade(); if (isset($defaultFade)) { @@ -196,7 +197,7 @@ class Application_Model_Scheduler foreach ($dynamicFiles as $f) { $fileId = $f['id']; $file = CcFilesQuery::create()->findPk($fileId); - if (isset($file) && $file->getDbFileExists()) { + if (isset($file) && $file->visible()) { $data["id"] = $file->getDbId(); $data["cliplength"] = $file->getDbLength(); $data["cuein"] = "00:00:00"; @@ -218,8 +219,8 @@ class Application_Model_Scheduler //need to return $stream = CcWebstreamQuery::create()->findPK($id, $this->con); - if (is_null($stream) /* || !$file->getDbFileExists() */) { - throw new Exception("A selected File does not exist!"); + if (is_null($stream) /* || !$file->visible() */) { + throw new Exception(_("A selected File does not exist!")); } else { $data = $this->fileInfo; $data["id"] = $id; @@ -254,7 +255,7 @@ class Application_Model_Scheduler foreach ($dynamicFiles as $f) { $fileId = $f['id']; $file = CcFilesQuery::create()->findPk($fileId); - if (isset($file) && $file->getDbFileExists()) { + if (isset($file) && $file->visible()) { $data["id"] = $file->getDbId(); $data["cliplength"] = $file->getDbLength(); $data["cuein"] = "00:00:00"; @@ -343,7 +344,7 @@ class Application_Model_Scheduler $instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con); if (is_null($instance)) { - throw new OutDatedScheduleException("The schedule you're viewing is out of date!"); + throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!")); } $itemStartDT = $instance->getDbStarts(null); diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 6f088046d..9db5e5f0b 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -177,7 +177,7 @@ SQL; $con = Propel::getConnection(); if ($deltaDay > 0) { - return "Shows can have a max length of 24 hours."; + return _("Shows can have a max length of 24 hours."); } $utc = new DateTimeZone("UTC"); @@ -189,7 +189,7 @@ SQL; ->find($con); /* Check two things: - 1. If the show being resized and any of its repeats end in the past + 1. If the show being resized and any of its repeats end in the past 2. If the show being resized and any of its repeats overlap with other scheduled shows */ @@ -208,7 +208,7 @@ SQL; $newEndsDateTime = Application_Model_ShowInstance::addDeltas($endsDateTime, $deltaDay, $deltaMin); if ($newEndsDateTime->getTimestamp() < $nowDateTime->getTimestamp()) { - return "End date/time cannot be in the past"; + return _("End date/time cannot be in the past"); } //convert our new starts/ends to UTC. @@ -219,8 +219,8 @@ SQL; $newStartsDateTime, $newEndsDateTime, true, $si->getDbId()); if ($overlapping) { - return "Cannot schedule overlapping shows.\nNote: Resizing a repeating show ". - "affects all of its repeats."; + return _("Cannot schedule overlapping shows.\nNote: Resizing a repeating show ". + "affects all of its repeats."); } } @@ -321,7 +321,7 @@ SQL; } catch (Exception $e) { Logging::info($e->getMessage()); } - } + } Application_Model_RabbitMq::PushSchedule(); } @@ -467,7 +467,7 @@ SQL; $startDateTime = new DateTime($show["starts"], $utc); $startDateTime->setTimezone($dtz); - $rebroadcastsLocal[$i]["start_date"] = + $rebroadcastsLocal[$i]["start_date"] = $startDateTime->format("Y-m-d"); $rebroadcastsLocal[$i]["start_time"] = $startDateTime->format("H:i"); @@ -533,7 +533,7 @@ SQL; ->filterByDbShowId($this->_showId) ->findOne(); - if (!is_null($showDaysRow)) + if (!is_null($showDaysRow)) return $showDaysRow->getDbRepeatType(); else return -1; @@ -582,7 +582,7 @@ WHERE starts > :timestamp::TIMESTAMP AND show_id = :showId SQL; Application_Common_Database::prepareAndExecute( $sql, - array( ':timestamp' => gmdate("Y-m-d H:i:s"), + array( ':timestamp' => gmdate("Y-m-d H:i:s"), ':showId' => $this->getId()), 'execute'); } @@ -838,7 +838,7 @@ WHERE show_id = :show_id AND ends > :timestamp::TIMESTAMP SQL; - Application_Common_Database::prepareAndExecute( $sql, array( + Application_Common_Database::prepareAndExecute( $sql, array( ':add_show_duration' => $p_data['add_show_duration'], ':show_id' => $p_data['add_show_id'], ':timestamp' => $timestamp), "execute"); @@ -1222,12 +1222,12 @@ SQL; SELECT :rebroadcast::date - :start::date SQL; - $offset_days = + $offset_days = Application_Common_Database::prepareAndExecute($sql, array( - 'rebroadcast' => + 'rebroadcast' => $data["add_show_rebroadcast_date_absolute_$i"], - 'start' => + 'start' => $data['add_show_start_date']), "column" ); //$r = $con->query($sql); @@ -1770,7 +1770,7 @@ SQL; $parentStartsEpoch = intval($parentStartsDT->format("U")); } - $startsDT = DateTime::createFromFormat("Y-m-d G:i:s", + $startsDT = DateTime::createFromFormat("Y-m-d G:i:s", $show["starts"],$utc); $endsDT = DateTime::createFromFormat("Y-m-d G:i:s", $show["ends"], $utc); @@ -1801,6 +1801,8 @@ SQL; $options["show_empty"] = (array_key_exists($show['instance_id'], $content_count)) ? 0 : 1; + + $options["show_partial_filled"] = $showInstance->showPartialFilled(); $events[] = &self::makeFullCalendarEvent($show, $options, $startsDT, $endsDT, $startsEpochStr, $endsEpochStr); @@ -1905,7 +1907,7 @@ SQL; */ public static function getCurrentShow($timeNow=null) { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $con = Propel::getConnection(); if ($timeNow == null) { $date = new Application_Common_DateHelper; @@ -1951,7 +1953,7 @@ SQL; */ public static function getPrevCurrentNext($p_timeNow) { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $con = Propel::getConnection(); // //TODO, returning starts + ends twice (once with an alias). Unify this after the 2.0 release. --Martin diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 175e61dfd..a1ef7c588 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -195,7 +195,7 @@ class Application_Model_ShowBuilder $dt->setTimezone(new DateTimeZone($this->timezone)); $time = $dt->format("Y-m-d H:i"); - $row["rebroadcast_title"] = "Rebroadcast of {$name} from {$time}"; + $row["rebroadcast_title"] = sprintf(_("Rebroadcast of %s from %s"), $name, $time); } elseif (intval($p_item["si_record"]) === 1) { $row["record"] = true; @@ -269,6 +269,7 @@ class Application_Model_ShowBuilder $cue_out = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_out']); $cue_in = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_in']); + $run_time = $cue_out-$cue_in; $formatter = new LengthFormatter(Application_Common_DateHelper::ConvertMSToHHMMSSmm($run_time*1000)); diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index 533118c29..14def6321 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -242,7 +242,7 @@ SQL; public function moveShow($deltaDay, $deltaMin) { if ($this->getShow()->isRepeating()) { - return "Can't drag and drop repeating shows"; + return _("Can't drag and drop repeating shows"); } $today_timestamp = time(); @@ -250,7 +250,7 @@ SQL; $endsDateTime = new DateTime($this->getShowInstanceEnd(), new DateTimeZone("UTC")); if ($today_timestamp > $startsDateTime->getTimestamp()) { - return "Can't move a past show"; + return _("Can't move a past show"); } //the user is moving the show on the calendar from the perspective of local time. @@ -267,13 +267,13 @@ SQL; $newEndsDateTime->setTimezone(new DateTimeZone("UTC")); if ($today_timestamp > $newStartsDateTime->getTimestamp()) { - return "Can't move show into past"; + return _("Can't move show into past"); } //check if show is overlapping $overlapping = Application_Model_Schedule::checkOverlappingShows($newStartsDateTime, $newEndsDateTime, true, $this->getShowInstanceId()); if ($overlapping) { - return "Cannot schedule overlapping shows"; + return _("Cannot schedule overlapping shows"); } if ($this->isRecorded()) { @@ -287,7 +287,7 @@ SQL; ->find(); if (count($rebroadcasts) > 0) { - return "Can't move a recorded show less than 1 hour before its rebroadcasts."; + return _("Can't move a recorded show less than 1 hour before its rebroadcasts."); } } @@ -300,14 +300,14 @@ SQL; catch (Exception $e) { $this->_showInstance->delete(); - return "Show was deleted because recorded show does not exist!"; + return _("Show was deleted because recorded show does not exist!"); } $recordEndDateTime = new DateTime($recordedShow->getShowInstanceEnd(), new DateTimeZone("UTC")); $newRecordEndDateTime = self::addDeltas($recordEndDateTime, 0, 60); if ($newStartsDateTime->getTimestamp() < $newRecordEndDateTime->getTimestamp()) { - return "Must wait 1 hour to rebroadcast."; + return _("Must wait 1 hour to rebroadcast."); } } @@ -339,7 +339,7 @@ SQL; $ends = $this->getShowInstanceEnd(); if (strtotime($today_timestamp) > strtotime($starts)) { - return "can't resize a past show"; + return _("can't resize a past show"); } //$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'"; @@ -361,7 +361,7 @@ SQL; if (count($overlap) > 0) { // TODO : fix ghetto error handling -- RG - return "Should not overlap shows"; + return _("Should not overlap shows"); } } //with overbooking no longer need to check already scheduled content still fits. @@ -687,6 +687,22 @@ SQL; } + public function showPartialFilled() + { + $sql = << '00:00:00' +AND time_filled < ends - starts +AND file_id IS null AS partial_filled +FROM cc_show_instances +WHERE id = :instance_id +SQL; + + $res = Application_Common_Database::prepareAndExecute($sql, + array(':instance_id' => $this->_instanceId), 'all'); + + return $res[0]["partial_filled"]; + } + public function showEmpty() { $sql = <<= 0 - AND s.file_id IS NOT NULL) + AND s.file_id IS NOT NULL + AND f.hidden = 'false') UNION (SELECT s.starts, 1::INTEGER as type, diff --git a/airtime_mvc/application/models/Soundcloud.php b/airtime_mvc/application/models/Soundcloud.php index 70148c05c..6c7b181d7 100644 --- a/airtime_mvc/application/models/Soundcloud.php +++ b/airtime_mvc/application/models/Soundcloud.php @@ -7,7 +7,7 @@ class Application_Model_Soundcloud public function __construct() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $this->_soundcloud = new Services_Soundcloud( $CC_CONFIG['soundcloud-client-id'], $CC_CONFIG['soundcloud-client-secret']); @@ -25,11 +25,11 @@ class Application_Model_Soundcloud public function uploadTrack($filepath, $filename, $description, $tags=array(), $release=null, $genre=null) - { + { if (!$this->getToken()) { throw new NoSoundCloundToken(); - } + } if (count($tags)) { $tags = join(" ", $tags); $tags = $tags." ".Application_Model_Preference::GetSoundCloudTags(); @@ -88,7 +88,7 @@ class Application_Model_Soundcloud } - public static function uploadSoundcloud($id) + public static function uploadSoundcloud($id) { $cmd = "/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &"; Logging::info("Uploading soundcloud with command: $cmd"); diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index fb924ac5c..bbeacdfe3 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -48,7 +48,9 @@ class Application_Model_StoredFile "language" => "DbLanguage", "replay_gain" => "DbReplayGain", "directory" => "DbDirectory", - "owner_id" => "DbOwnerId" + "owner_id" => "DbOwnerId", + "cuein" => "DbCueIn", + "cueout" => "DbCueOut", ); public function getId() @@ -127,9 +129,15 @@ class Application_Model_StoredFile # Translate metadata attributes from media monitor (MDATA_KEY_*) # to their counterparts in constants.php (usually the column names) + $track_length = $p_md['MDATA_KEY_DURATION']; + $track_length_in_sec = Application_Common_DateHelper::calculateLengthInSeconds($track_length); foreach ($p_md as $mdConst => $mdValue) { if (defined($mdConst)) { + if ($mdConst == "MDATA_KEY_CUE_OUT" && $mdValue == '0.0') { + $mdValue = $track_length_in_sec; + } $dbMd[constant($mdConst)] = $mdValue; + } else { Logging::warn("using metadata that is not defined. [$mdConst] => [$mdValue]"); @@ -177,7 +185,7 @@ class Application_Model_StoredFile $this->_file->setDbOwnerId( $owner->getDbId() ); } else { Logging::info("Could not find suitable owner for file - '".$p_md['MDATA_KEY_FILEPATH']."'"); + '".$p_md['filepath']."'"); } } # We don't want to process owner_id in bulk because we already @@ -359,8 +367,9 @@ SQL; Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data); } - // set file_exists flag to false - $this->_file->setDbFileExists(false); + + // set hidden flag to true + $this->_file->setDbHidden(true); $this->_file->save(); // need to explicitly update any playlist's and block's length @@ -437,7 +446,7 @@ SQL; return "flac"; } elseif ($mime == "audio/mp4") { return "mp4"; - } else { + } else { throw new Exception("Unknown $mime"); } } @@ -495,7 +504,7 @@ SQL; */ public function getFileUrlUsingConfigAddress() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); if (isset($CC_CONFIG['baseUrl'])) { $serverName = $CC_CONFIG['baseUrl']; @@ -523,7 +532,7 @@ SQL; */ public function getRelativeFileUrl($baseUrl) { - return $baseUrl."/api/get-media/file/".$this->getId().".".$this->getFileExtension(); + return $baseUrl."api/get-media/file/".$this->getId().".".$this->getFileExtension(); } public static function Insert($md) @@ -558,10 +567,10 @@ SQL; public static function Recall($p_id=null, $p_gunid=null, $p_md5sum=null, $p_filepath=null) { - if( isset($p_id ) ) { + if( isset($p_id ) ) { $f = CcFilesQuery::create()->findPK(intval($p_id)); return is_null($f) ? null : self::createWithFile($f); - } elseif ( isset($p_gunid) ) { + } elseif ( isset($p_gunid) ) { throw new Exception("You should never use gunid ($gunid) anymore"); } elseif ( isset($p_md5sum) ) { throw new Exception("Searching by md5($p_md5sum) is disabled"); @@ -624,6 +633,7 @@ SQL; return $res; } + public static function getLibraryColumns() { return array("id", "track_title", "artist_name", "album_title", @@ -634,9 +644,10 @@ SQL; "conductor", "replay_gain", "lptime" ); } - public static function searchLibraryFiles($datatables) { + $baseUrl = Application_Common_OsPath::getBaseDir(); + $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME); $displayColumns = self::getLibraryColumns(); @@ -706,6 +717,11 @@ SQL; $blSelect[] = "NULL::VARCHAR AS ".$key; $fileSelect[] = $key; $streamSelect[] = "url AS ".$key; + } else if ($key == "mime") { + $plSelect[] = "NULL::VARCHAR AS ".$key; + $blSelect[] = "NULL::VARCHAR AS ".$key; + $fileSelect[] = $key; + $streamSelect[] = $key; } else { $plSelect[] = "NULL::text AS ".$key; $blSelect[] = "NULL::text AS ".$key; @@ -723,7 +739,7 @@ SQL; $plTable = "({$plSelect} FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id))"; $blTable = "({$blSelect} FROM cc_block AS BL LEFT JOIN cc_subjs AS sub ON (sub.id = BL.creator_id))"; - $fileTable = "({$fileSelect} FROM cc_files AS FILES LEFT JOIN cc_subjs AS sub ON (sub.id = FILES.owner_id) WHERE file_exists = 'TRUE')"; + $fileTable = "({$fileSelect} FROM cc_files AS FILES LEFT JOIN cc_subjs AS sub ON (sub.id = FILES.owner_id) WHERE file_exists = 'TRUE' AND hidden='FALSE')"; //$fileTable = "({$fileSelect} FROM cc_files AS FILES WHERE file_exists = 'TRUE')"; $streamTable = "({$streamSelect} FROM cc_webstream AS ws LEFT JOIN cc_subjs AS sub ON (sub.id = ws.creator_id))"; $unionTable = "({$plTable} UNION {$blTable} UNION {$fileTable} UNION {$streamTable}) AS RESULTS"; @@ -787,18 +803,18 @@ SQL; //generalized within the project access to zend view methods //to access url helpers is needed. - // TODO : why is there inline html here? breaks abstraction and is + // TODO : why is there inline html here? breaks abstraction and is // ugly if ($type == "au") { $row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); - $row['image'] = ''; + $row['image'] = ''; } elseif ($type == "pl") { - $row['image'] = ''; + $row['image'] = ''; } elseif ($type == "st") { $row['audioFile'] = $row['id']; - $row['image'] = ''; + $row['image'] = ''; } elseif ($type == "bl") { - $row['image'] = ''; + $row['image'] = ''; } } @@ -850,7 +866,7 @@ SQL; closedir($dir); } else - die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}'); + die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": _("Failed to open temp directory.")}, "id" : "id"}'); // Look for the content type header if (isset($_SERVER["HTTP_CONTENT_TYPE"])) @@ -877,14 +893,14 @@ SQL; while ($buff = fread($in, 4096)) fwrite($out, $buff); } else - die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); + die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}'); fclose($out); unlink($_FILES['file']['tmp_name']); } else - die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}'); + die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": _("Failed to open output stream.")}, "id" : "id"}'); } else - die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}'); + die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": _("Failed to move uploaded file.")}, "id" : "id"}'); } else { // Open temp file $out = fopen($tempFilePath, $chunk == 0 ? "wb" : "ab"); @@ -896,11 +912,11 @@ SQL; while ($buff = fread($in, 4096)) fwrite($out, $buff); } else - die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); + die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": _("Failed to open input stream.")}, "id" : "id"}'); fclose($out); } else - die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}'); + die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": _("Failed to open output stream.")}, "id" : "id"}'); } return $tempFilePath; @@ -931,7 +947,7 @@ SQL; if (!mkdir($stor."/organize", 0777)) { return array( "code" => 109, - "message" => "Failed to create 'organize' directory."); + "message" => _("Failed to create 'organize' directory.")); } } @@ -944,17 +960,17 @@ SQL; $freeSpace = disk_free_space($stor); return array("code" => 107, - "message" => "The file was not uploaded, there is - ".$freeSpace."MB of disk space left and the file you are - uploading has a size of ".$fileSize."MB."); + "message" => sprintf(_("The file was not uploaded, there is " + ."%s MB of disk space left and the file you are " + ."uploading has a size of %s MB."), $freeSpace, $fileSize)); } // Check if liquidsoap can play this file if (!self::liquidsoapFilePlayabilityTest($audio_file)) { return array( "code" => 110, - "message" => "This file appears to be corrupted and will not - be added to media library."); + "message" => _("This file appears to be corrupted and will not " + ."be added to media library.")); } // Did all the checks for real, now trying to copy @@ -989,10 +1005,9 @@ SQL; return array( "code" => 108, - "message" => " - The file was not uploaded, this error can occur if the computer - hard drive does not have enough disk space or the stor - directory does not have correct write permissions."); + "message" => _("The file was not uploaded, this error can occur if the computer " + ."hard drive does not have enough disk space or the stor " + ."directory does not have correct write permissions.")); } // Now that we successfully added this file, we will add another tag // file that will identify the user that owns it @@ -1036,8 +1051,12 @@ SQL; $sql = <<_file->setDbFileExists($flag) ->save(); } + public function setFileHiddenFlag($flag) + { + $this->_file->setDbHidden($flag) + ->save(); + } public function setSoundCloudUploadTime($time) { $this->_file->setDbSoundCloundUploadTime($time) ->save(); } - public function getFileExistsFlag() - { - return $this->_file->getDbFileExists(); - } + + // This method seems to be unsued everywhere so I've commented it out + // If it's absence does not have any effect then it will be completely + // removed soon + //public function getFileExistsFlag() + //{ + //return $this->_file->getDbFileExists(); + //} public function getFileOwnerId() { @@ -1190,7 +1218,7 @@ SQL; // note: never call this method from controllers because it does a sleep public function uploadToSoundCloud() { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $file = $this->_file; if (is_null($file)) { diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index f1b1e372c..6bac3f02b 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -163,7 +163,7 @@ class Application_Model_StreamSetting $con = Propel::getConnection(); $sql = "SELECT *" ." FROM cc_stream_setting" - ." WHERE keyname not like '%_error'"; + ." WHERE keyname not like '%_error' AND keyname not like '%_admin_%'"; $rows = $con->query($sql)->fetchAll(); @@ -433,4 +433,37 @@ class Application_Model_StreamSetting { return self::getValue("dj_live_stream_mp"); } + + public static function getAdminUser($stream){ + return self::getValue($stream."_admin_user"); + } + + public static function setAdminUser($stream, $v){ + self::setValue($stream."_admin_user", $v, "string"); + } + + public static function getAdminPass($stream){ + return self::getValue($stream."_admin_pass"); + } + + public static function setAdminPass($stream, $v){ + self::setValue($stream."_admin_pass", $v, "string"); + } + + public static function getOffAirMeta(){ + return self::getValue("off_air_meta"); + } + + public static function setOffAirMeta($offAirMeta){ + self::setValue("off_air_meta", $offAirMeta, "string"); + } + + public static function GetAllListenerStatErrors(){ + $sql = "SELECT * FROM cc_stream_setting WHERE keyname like :p1"; + return Application_Common_Database::prepareAndExecute($sql, array(':p1'=>'%_listener_stat_error')); + } + + public static function SetListenerStatError($key, $v) { + self::setValue($key, $v, 'string'); + } } diff --git a/airtime_mvc/application/models/Subjects.php b/airtime_mvc/application/models/Subjects.php index 6aa2708a2..8977bcd12 100644 --- a/airtime_mvc/application/models/Subjects.php +++ b/airtime_mvc/application/models/Subjects.php @@ -20,9 +20,8 @@ class Application_Model_Subjects public static function increaseLoginAttempts($login) { - global $CC_CONFIG; $con = Propel::getConnection(); - $sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = login_attempts+1" + $sql = "UPDATE cc_subjs SET login_attempts = login_attempts+1" ." WHERE login='$login'"; $res = $con->exec($sql); @@ -31,9 +30,8 @@ class Application_Model_Subjects public static function resetLoginAttempts($login) { - global $CC_CONFIG; $con = Propel::getConnection(); - $sql = "UPDATE ".$CC_CONFIG['subjTable']." SET login_attempts = '0'" + $sql = "UPDATE cc_subjs SET login_attempts = '0'" ." WHERE login='$login'"; $res = $con->exec($sql); @@ -42,9 +40,8 @@ class Application_Model_Subjects public static function getLoginAttempts($login) { - global $CC_CONFIG; $con = Propel::getConnection(); - $sql = "SELECT login_attempts FROM ".$CC_CONFIG['subjTable']." WHERE login='$login'"; + $sql = "SELECT login_attempts FROM cc_subjs WHERE login='$login'"; $res = $con->query($sql)->fetchColumn(0); return ($res !== false) ? $res : 0; diff --git a/airtime_mvc/application/models/Systemstatus.php b/airtime_mvc/application/models/Systemstatus.php index d62ad7110..ef694ccf2 100644 --- a/airtime_mvc/application/models/Systemstatus.php +++ b/airtime_mvc/application/models/Systemstatus.php @@ -5,7 +5,7 @@ class Application_Model_Systemstatus public static function GetMonitStatus($p_ip) { - global $CC_CONFIG; + $CC_CONFIG = Config::getConfig(); $monit_user = $CC_CONFIG['monit_user']; $monit_password = $CC_CONFIG['monit_password']; diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php index 30c7d181d..a39b26bde 100644 --- a/airtime_mvc/application/models/Webstream.php +++ b/airtime_mvc/application/models/Webstream.php @@ -154,12 +154,12 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable if ($totalMinutes == 0) { $valid['length'][0] = false; - $valid['length'][1] = 'Length needs to be greater than 0 minutes'; + $valid['length'][1] = _('Length needs to be greater than 0 minutes'); } } else { $valid['length'][0] = false; - $valid['length'][1] = 'Length should be of form "00h 00m"'; + $valid['length'][1] = _('Length should be of form "00h 00m"'); } $url = $parameters["url"]; @@ -172,16 +172,16 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $mediaUrl = null; if ($result == 0) { $valid['url'][0] = false; - $valid['url'][1] = 'URL should be of form "http://domain"'; + $valid['url'][1] = _('URL should be of form "http://domain"'); } elseif (strlen($url) > 512) { $valid['url'][0] = false; - $valid['url'][1] = 'URL should be 512 characters or less'; + $valid['url'][1] = _('URL should be 512 characters or less'); } else { try { list($mime, $content_length_found) = self::discoverStreamMime($url); if (is_null($mime)) { - throw new Exception("No MIME type found for webstream."); + throw new Exception(_("No MIME type found for webstream.")); } $mediaUrl = self::getMediaUrl($url, $mime, $content_length_found); @@ -197,7 +197,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $name = $parameters["name"]; if (strlen($name) == 0) { $valid['name'][0] = false; - $valid['name'][1] = 'Webstream name cannot be empty'; + $valid['name'][1] = _('Webstream name cannot be empty'); } $id = $parameters["id"]; @@ -266,7 +266,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable } } - throw new Exception("Could not parse XSPF playlist"); + throw new Exception(_("Could not parse XSPF playlist")); } private static function getPlsUrl($url) @@ -278,7 +278,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable return $ini["playlist"]["File1"]; } - throw new Exception("Could not parse PLS playlist"); + throw new Exception(_("Could not parse PLS playlist")); } private static function getM3uUrl($url) @@ -297,7 +297,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable return $lines[0]; } - throw new Exception("Could not parse M3U playlist"); + throw new Exception(_("Could not parse M3U playlist")); } private static function getMediaUrl($url, $mime, $content_length_found) @@ -311,11 +311,11 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable $media_url = self::getPlsUrl($url); } elseif (preg_match("/(mpeg|ogg|audio\/aacp)/", $mime)) { if ($content_length_found) { - throw new Exception("Invalid webstream - This appears to be a file download."); + throw new Exception(_("Invalid webstream - This appears to be a file download.")); } $media_url = $url; } else { - throw new Exception("Unrecognized stream type: $mime"); + throw new Exception(sprintf(_("Unrecognized stream type: %s"), $mime)); } return $media_url; diff --git a/airtime_mvc/application/models/airtime/CcFiles.php b/airtime_mvc/application/models/airtime/CcFiles.php index 5e35d4790..9c6bc8359 100644 --- a/airtime_mvc/application/models/airtime/CcFiles.php +++ b/airtime_mvc/application/models/airtime/CcFiles.php @@ -41,6 +41,11 @@ class CcFiles extends BaseCcFiles { return $this; } + // returns true if the file exists and is not hidden + public function visible() { + return $this->getDbFileExists() && !$this->getDbHidden(); + } + public function reassignTo($user) { $this->setDbOwnerId( $user->getDbId() ); diff --git a/airtime_mvc/application/models/airtime/CcLocale.php b/airtime_mvc/application/models/airtime/CcLocale.php new file mode 100644 index 000000000..6953ae6b3 --- /dev/null +++ b/airtime_mvc/application/models/airtime/CcLocale.php @@ -0,0 +1,18 @@ +prepare($sql); $stmt->bindValue(':p1', $this->getDbId()); diff --git a/airtime_mvc/application/models/airtime/CcPlaylistcontents.php b/airtime_mvc/application/models/airtime/CcPlaylistcontents.php index ab0aa6d56..e7f6eb97d 100644 --- a/airtime_mvc/application/models/airtime/CcPlaylistcontents.php +++ b/airtime_mvc/application/models/airtime/CcPlaylistcontents.php @@ -68,7 +68,8 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents { $this->fadein = $dt->format('H:i:s').".".$microsecond; } $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN; - + $this->save(); + return $this; } // setDbFadein() @@ -105,7 +106,8 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents { $this->fadeout = $dt->format('H:i:s').".".$microsecond; } $this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT; - + $this->save(); + return $this; } // setDbFadeout() diff --git a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php index 008c63007..8c810b098 100644 --- a/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php +++ b/airtime_mvc/application/models/airtime/map/CcFilesTableMap.php @@ -102,6 +102,9 @@ class CcFilesTableMap extends TableMap { $this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null); $this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'NUMERIC', false, null, null); $this->addForeignKey('OWNER_ID', 'DbOwnerId', 'INTEGER', 'cc_subjs', 'ID', false, null, null); + $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00'); + $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00'); + $this->addColumn('HIDDEN', 'DbHidden', 'BOOLEAN', false, null, false); // validators } // initialize() diff --git a/airtime_mvc/application/models/airtime/map/CcLocaleTableMap.php b/airtime_mvc/application/models/airtime/map/CcLocaleTableMap.php new file mode 100644 index 000000000..e6b51fc12 --- /dev/null +++ b/airtime_mvc/application/models/airtime/map/CcLocaleTableMap.php @@ -0,0 +1,54 @@ +setName('cc_locale'); + $this->setPhpName('CcLocale'); + $this->setClassname('CcLocale'); + $this->setPackage('airtime'); + $this->setUseIdGenerator(true); + $this->setPrimaryKeyMethodInfo('cc_locale_id_seq'); + // columns + $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); + $this->addColumn('LOCALE_CODE', 'DbLocaleCode', 'VARCHAR', true, 16, null); + $this->addColumn('LOCALE_LANG', 'DbLocaleLang', 'VARCHAR', true, 128, null); + // validators + } // initialize() + + /** + * Build the RelationMap objects for this table relationships + */ + public function buildRelations() + { + } // buildRelations() + +} // CcLocaleTableMap diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php index a18d65dca..31eeb96a5 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFiles.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFiles.php @@ -416,6 +416,27 @@ abstract class BaseCcFiles extends BaseObject implements Persistent */ protected $owner_id; + /** + * The value for the cuein field. + * Note: this column has a database default value of: '00:00:00' + * @var string + */ + protected $cuein; + + /** + * The value for the cueout field. + * Note: this column has a database default value of: '00:00:00' + * @var string + */ + protected $cueout; + + /** + * The value for the hidden field. + * Note: this column has a database default value of: false + * @var boolean + */ + protected $hidden; + /** * @var CcSubjs */ @@ -481,6 +502,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->currentlyaccessing = 0; $this->length = '00:00:00'; $this->file_exists = true; + $this->cuein = '00:00:00'; + $this->cueout = '00:00:00'; + $this->hidden = false; } /** @@ -1225,6 +1249,36 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this->owner_id; } + /** + * Get the [cuein] column value. + * + * @return string + */ + public function getDbCuein() + { + return $this->cuein; + } + + /** + * Get the [cueout] column value. + * + * @return string + */ + public function getDbCueout() + { + return $this->cueout; + } + + /** + * Get the [hidden] column value. + * + * @return boolean + */ + public function getDbHidden() + { + return $this->hidden; + } + /** * Set the value of [id] column. * @@ -2633,6 +2687,66 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return $this; } // setDbOwnerId() + /** + * Set the value of [cuein] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbCuein($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->cuein !== $v || $this->isNew()) { + $this->cuein = $v; + $this->modifiedColumns[] = CcFilesPeer::CUEIN; + } + + return $this; + } // setDbCuein() + + /** + * Set the value of [cueout] column. + * + * @param string $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbCueout($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->cueout !== $v || $this->isNew()) { + $this->cueout = $v; + $this->modifiedColumns[] = CcFilesPeer::CUEOUT; + } + + return $this; + } // setDbCueout() + + /** + * Set the value of [hidden] column. + * + * @param boolean $v new value + * @return CcFiles The current object (for fluent API support) + */ + public function setDbHidden($v) + { + if ($v !== null) { + $v = (boolean) $v; + } + + if ($this->hidden !== $v || $this->isNew()) { + $this->hidden = $v; + $this->modifiedColumns[] = CcFilesPeer::HIDDEN; + } + + return $this; + } // setDbHidden() + /** * Indicates whether the columns in this object are only set to default values. * @@ -2675,6 +2789,18 @@ abstract class BaseCcFiles extends BaseObject implements Persistent return false; } + if ($this->cuein !== '00:00:00') { + return false; + } + + if ($this->cueout !== '00:00:00') { + return false; + } + + if ($this->hidden !== false) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -2761,6 +2887,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->soundcloud_upload_time = ($row[$startcol + 61] !== null) ? (string) $row[$startcol + 61] : null; $this->replay_gain = ($row[$startcol + 62] !== null) ? (string) $row[$startcol + 62] : null; $this->owner_id = ($row[$startcol + 63] !== null) ? (int) $row[$startcol + 63] : null; + $this->cuein = ($row[$startcol + 64] !== null) ? (string) $row[$startcol + 64] : null; + $this->cueout = ($row[$startcol + 65] !== null) ? (string) $row[$startcol + 65] : null; + $this->hidden = ($row[$startcol + 66] !== null) ? (boolean) $row[$startcol + 66] : null; $this->resetModified(); $this->setNew(false); @@ -2769,7 +2898,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 64; // 64 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 67; // 67 = CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcFiles object", $e); @@ -3394,6 +3523,15 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case 63: return $this->getDbOwnerId(); break; + case 64: + return $this->getDbCuein(); + break; + case 65: + return $this->getDbCueout(); + break; + case 66: + return $this->getDbHidden(); + break; default: return null; break; @@ -3482,6 +3620,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $keys[61] => $this->getDbSoundCloundUploadTime(), $keys[62] => $this->getDbReplayGain(), $keys[63] => $this->getDbOwnerId(), + $keys[64] => $this->getDbCuein(), + $keys[65] => $this->getDbCueout(), + $keys[66] => $this->getDbHidden(), ); if ($includeForeignObjects) { if (null !== $this->aFkOwner) { @@ -3716,6 +3857,15 @@ abstract class BaseCcFiles extends BaseObject implements Persistent case 63: $this->setDbOwnerId($value); break; + case 64: + $this->setDbCuein($value); + break; + case 65: + $this->setDbCueout($value); + break; + case 66: + $this->setDbHidden($value); + break; } // switch() } @@ -3804,6 +3954,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if (array_key_exists($keys[61], $arr)) $this->setDbSoundCloundUploadTime($arr[$keys[61]]); if (array_key_exists($keys[62], $arr)) $this->setDbReplayGain($arr[$keys[62]]); if (array_key_exists($keys[63], $arr)) $this->setDbOwnerId($arr[$keys[63]]); + if (array_key_exists($keys[64], $arr)) $this->setDbCuein($arr[$keys[64]]); + if (array_key_exists($keys[65], $arr)) $this->setDbCueout($arr[$keys[65]]); + if (array_key_exists($keys[66], $arr)) $this->setDbHidden($arr[$keys[66]]); } /** @@ -3879,6 +4032,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent if ($this->isColumnModified(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME)) $criteria->add(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME, $this->soundcloud_upload_time); if ($this->isColumnModified(CcFilesPeer::REPLAY_GAIN)) $criteria->add(CcFilesPeer::REPLAY_GAIN, $this->replay_gain); if ($this->isColumnModified(CcFilesPeer::OWNER_ID)) $criteria->add(CcFilesPeer::OWNER_ID, $this->owner_id); + if ($this->isColumnModified(CcFilesPeer::CUEIN)) $criteria->add(CcFilesPeer::CUEIN, $this->cuein); + if ($this->isColumnModified(CcFilesPeer::CUEOUT)) $criteria->add(CcFilesPeer::CUEOUT, $this->cueout); + if ($this->isColumnModified(CcFilesPeer::HIDDEN)) $criteria->add(CcFilesPeer::HIDDEN, $this->hidden); return $criteria; } @@ -4003,6 +4159,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $copyObj->setDbSoundCloundUploadTime($this->soundcloud_upload_time); $copyObj->setDbReplayGain($this->replay_gain); $copyObj->setDbOwnerId($this->owner_id); + $copyObj->setDbCuein($this->cuein); + $copyObj->setDbCueout($this->cueout); + $copyObj->setDbHidden($this->hidden); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -4905,6 +5064,9 @@ abstract class BaseCcFiles extends BaseObject implements Persistent $this->soundcloud_upload_time = null; $this->replay_gain = null; $this->owner_id = null; + $this->cuein = null; + $this->cueout = null; + $this->hidden = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->clearAllReferences(); diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php index c155c3c2a..da22cce2a 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcFilesPeer { const TM_CLASS = 'CcFilesTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 64; + const NUM_COLUMNS = 67; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -223,6 +223,15 @@ abstract class BaseCcFilesPeer { /** the column name for the OWNER_ID field */ const OWNER_ID = 'cc_files.OWNER_ID'; + /** the column name for the CUEIN field */ + const CUEIN = 'cc_files.CUEIN'; + + /** the column name for the CUEOUT field */ + const CUEOUT = 'cc_files.CUEOUT'; + + /** the column name for the HIDDEN field */ + const HIDDEN = 'cc_files.HIDDEN'; + /** * An identiy map to hold any loaded instances of CcFiles objects. * This must be public so that other peer classes can access this when hydrating from JOIN @@ -239,12 +248,12 @@ abstract class BaseCcFilesPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', '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', 'DbFileExists', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'DbOwnerId', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', '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', 'dbFileExists', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'dbOwnerId', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::UTIME, self::LPTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, self::FILE_EXISTS, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, self::SOUNDCLOUD_UPLOAD_TIME, self::REPLAY_GAIN, self::OWNER_ID, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', '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', 'FILE_EXISTS', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', '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', 'file_exists', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_id', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMime', 'DbFtype', 'DbDirectory', 'DbFilepath', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', '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', 'DbFileExists', 'DbSoundcloudId', 'DbSoundcloudErrorCode', 'DbSoundcloudErrorMsg', 'DbSoundcloudLinkToFile', 'DbSoundCloundUploadTime', 'DbReplayGain', 'DbOwnerId', 'DbCuein', 'DbCueout', 'DbHidden', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMime', 'dbFtype', 'dbDirectory', 'dbFilepath', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', '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', 'dbFileExists', 'dbSoundcloudId', 'dbSoundcloudErrorCode', 'dbSoundcloudErrorMsg', 'dbSoundcloudLinkToFile', 'dbSoundCloundUploadTime', 'dbReplayGain', 'dbOwnerId', 'dbCuein', 'dbCueout', 'dbHidden', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MIME, self::FTYPE, self::DIRECTORY, self::FILEPATH, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::UTIME, self::LPTIME, self::MD5, self::TRACK_TITLE, self::ARTIST_NAME, self::BIT_RATE, self::SAMPLE_RATE, self::FORMAT, self::LENGTH, self::ALBUM_TITLE, self::GENRE, self::COMMENTS, self::YEAR, self::TRACK_NUMBER, self::CHANNELS, self::URL, self::BPM, self::RATING, self::ENCODED_BY, self::DISC_NUMBER, self::MOOD, self::LABEL, self::COMPOSER, self::ENCODER, self::CHECKSUM, self::LYRICS, self::ORCHESTRA, self::CONDUCTOR, self::LYRICIST, self::ORIGINAL_LYRICIST, self::RADIO_STATION_NAME, self::INFO_URL, self::ARTIST_URL, self::AUDIO_SOURCE_URL, self::RADIO_STATION_URL, self::BUY_THIS_URL, self::ISRC_NUMBER, self::CATALOG_NUMBER, self::ORIGINAL_ARTIST, self::COPYRIGHT, self::REPORT_DATETIME, self::REPORT_LOCATION, self::REPORT_ORGANIZATION, self::SUBJECT, self::CONTRIBUTOR, self::LANGUAGE, self::FILE_EXISTS, self::SOUNDCLOUD_ID, self::SOUNDCLOUD_ERROR_CODE, self::SOUNDCLOUD_ERROR_MSG, self::SOUNDCLOUD_LINK_TO_FILE, self::SOUNDCLOUD_UPLOAD_TIME, self::REPLAY_GAIN, self::OWNER_ID, self::CUEIN, self::CUEOUT, self::HIDDEN, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MIME', 'FTYPE', 'DIRECTORY', 'FILEPATH', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', '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', 'FILE_EXISTS', 'SOUNDCLOUD_ID', 'SOUNDCLOUD_ERROR_CODE', 'SOUNDCLOUD_ERROR_MSG', 'SOUNDCLOUD_LINK_TO_FILE', 'SOUNDCLOUD_UPLOAD_TIME', 'REPLAY_GAIN', 'OWNER_ID', 'CUEIN', 'CUEOUT', 'HIDDEN', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mime', 'ftype', 'directory', 'filepath', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', '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', 'file_exists', 'soundcloud_id', 'soundcloud_error_code', 'soundcloud_error_msg', 'soundcloud_link_to_file', 'soundcloud_upload_time', 'replay_gain', 'owner_id', 'cuein', 'cueout', 'hidden', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, ) ); /** @@ -254,12 +263,12 @@ abstract class BaseCcFilesPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbState' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'DbOwnerId' => 63, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbState' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'dbOwnerId' => 63, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MIME => 2, self::FTYPE => 3, self::DIRECTORY => 4, self::FILEPATH => 5, self::STATE => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::UTIME => 10, self::LPTIME => 11, self::MD5 => 12, self::TRACK_TITLE => 13, self::ARTIST_NAME => 14, self::BIT_RATE => 15, self::SAMPLE_RATE => 16, self::FORMAT => 17, self::LENGTH => 18, self::ALBUM_TITLE => 19, self::GENRE => 20, self::COMMENTS => 21, self::YEAR => 22, self::TRACK_NUMBER => 23, self::CHANNELS => 24, self::URL => 25, self::BPM => 26, self::RATING => 27, self::ENCODED_BY => 28, self::DISC_NUMBER => 29, self::MOOD => 30, self::LABEL => 31, self::COMPOSER => 32, self::ENCODER => 33, self::CHECKSUM => 34, self::LYRICS => 35, self::ORCHESTRA => 36, self::CONDUCTOR => 37, self::LYRICIST => 38, self::ORIGINAL_LYRICIST => 39, self::RADIO_STATION_NAME => 40, self::INFO_URL => 41, self::ARTIST_URL => 42, self::AUDIO_SOURCE_URL => 43, self::RADIO_STATION_URL => 44, self::BUY_THIS_URL => 45, self::ISRC_NUMBER => 46, self::CATALOG_NUMBER => 47, self::ORIGINAL_ARTIST => 48, self::COPYRIGHT => 49, self::REPORT_DATETIME => 50, self::REPORT_LOCATION => 51, self::REPORT_ORGANIZATION => 52, self::SUBJECT => 53, self::CONTRIBUTOR => 54, self::LANGUAGE => 55, self::FILE_EXISTS => 56, self::SOUNDCLOUD_ID => 57, self::SOUNDCLOUD_ERROR_CODE => 58, self::SOUNDCLOUD_ERROR_MSG => 59, self::SOUNDCLOUD_LINK_TO_FILE => 60, self::SOUNDCLOUD_UPLOAD_TIME => 61, self::REPLAY_GAIN => 62, self::OWNER_ID => 63, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'STATE' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMime' => 2, 'DbFtype' => 3, 'DbDirectory' => 4, 'DbFilepath' => 5, 'DbState' => 6, 'DbCurrentlyaccessing' => 7, 'DbEditedby' => 8, 'DbMtime' => 9, 'DbUtime' => 10, 'DbLPtime' => 11, 'DbMd5' => 12, 'DbTrackTitle' => 13, 'DbArtistName' => 14, 'DbBitRate' => 15, 'DbSampleRate' => 16, 'DbFormat' => 17, 'DbLength' => 18, 'DbAlbumTitle' => 19, 'DbGenre' => 20, 'DbComments' => 21, 'DbYear' => 22, 'DbTrackNumber' => 23, 'DbChannels' => 24, 'DbUrl' => 25, 'DbBpm' => 26, 'DbRating' => 27, 'DbEncodedBy' => 28, 'DbDiscNumber' => 29, 'DbMood' => 30, 'DbLabel' => 31, 'DbComposer' => 32, 'DbEncoder' => 33, 'DbChecksum' => 34, 'DbLyrics' => 35, 'DbOrchestra' => 36, 'DbConductor' => 37, 'DbLyricist' => 38, 'DbOriginalLyricist' => 39, 'DbRadioStationName' => 40, 'DbInfoUrl' => 41, 'DbArtistUrl' => 42, 'DbAudioSourceUrl' => 43, 'DbRadioStationUrl' => 44, 'DbBuyThisUrl' => 45, 'DbIsrcNumber' => 46, 'DbCatalogNumber' => 47, 'DbOriginalArtist' => 48, 'DbCopyright' => 49, 'DbReportDatetime' => 50, 'DbReportLocation' => 51, 'DbReportOrganization' => 52, 'DbSubject' => 53, 'DbContributor' => 54, 'DbLanguage' => 55, 'DbFileExists' => 56, 'DbSoundcloudId' => 57, 'DbSoundcloudErrorCode' => 58, 'DbSoundcloudErrorMsg' => 59, 'DbSoundcloudLinkToFile' => 60, 'DbSoundCloundUploadTime' => 61, 'DbReplayGain' => 62, 'DbOwnerId' => 63, 'DbCuein' => 64, 'DbCueout' => 65, 'DbHidden' => 66, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMime' => 2, 'dbFtype' => 3, 'dbDirectory' => 4, 'dbFilepath' => 5, 'dbState' => 6, 'dbCurrentlyaccessing' => 7, 'dbEditedby' => 8, 'dbMtime' => 9, 'dbUtime' => 10, 'dbLPtime' => 11, 'dbMd5' => 12, 'dbTrackTitle' => 13, 'dbArtistName' => 14, 'dbBitRate' => 15, 'dbSampleRate' => 16, 'dbFormat' => 17, 'dbLength' => 18, 'dbAlbumTitle' => 19, 'dbGenre' => 20, 'dbComments' => 21, 'dbYear' => 22, 'dbTrackNumber' => 23, 'dbChannels' => 24, 'dbUrl' => 25, 'dbBpm' => 26, 'dbRating' => 27, 'dbEncodedBy' => 28, 'dbDiscNumber' => 29, 'dbMood' => 30, 'dbLabel' => 31, 'dbComposer' => 32, 'dbEncoder' => 33, 'dbChecksum' => 34, 'dbLyrics' => 35, 'dbOrchestra' => 36, 'dbConductor' => 37, 'dbLyricist' => 38, 'dbOriginalLyricist' => 39, 'dbRadioStationName' => 40, 'dbInfoUrl' => 41, 'dbArtistUrl' => 42, 'dbAudioSourceUrl' => 43, 'dbRadioStationUrl' => 44, 'dbBuyThisUrl' => 45, 'dbIsrcNumber' => 46, 'dbCatalogNumber' => 47, 'dbOriginalArtist' => 48, 'dbCopyright' => 49, 'dbReportDatetime' => 50, 'dbReportLocation' => 51, 'dbReportOrganization' => 52, 'dbSubject' => 53, 'dbContributor' => 54, 'dbLanguage' => 55, 'dbFileExists' => 56, 'dbSoundcloudId' => 57, 'dbSoundcloudErrorCode' => 58, 'dbSoundcloudErrorMsg' => 59, 'dbSoundcloudLinkToFile' => 60, 'dbSoundCloundUploadTime' => 61, 'dbReplayGain' => 62, 'dbOwnerId' => 63, 'dbCuein' => 64, 'dbCueout' => 65, 'dbHidden' => 66, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MIME => 2, self::FTYPE => 3, self::DIRECTORY => 4, self::FILEPATH => 5, self::STATE => 6, self::CURRENTLYACCESSING => 7, self::EDITEDBY => 8, self::MTIME => 9, self::UTIME => 10, self::LPTIME => 11, self::MD5 => 12, self::TRACK_TITLE => 13, self::ARTIST_NAME => 14, self::BIT_RATE => 15, self::SAMPLE_RATE => 16, self::FORMAT => 17, self::LENGTH => 18, self::ALBUM_TITLE => 19, self::GENRE => 20, self::COMMENTS => 21, self::YEAR => 22, self::TRACK_NUMBER => 23, self::CHANNELS => 24, self::URL => 25, self::BPM => 26, self::RATING => 27, self::ENCODED_BY => 28, self::DISC_NUMBER => 29, self::MOOD => 30, self::LABEL => 31, self::COMPOSER => 32, self::ENCODER => 33, self::CHECKSUM => 34, self::LYRICS => 35, self::ORCHESTRA => 36, self::CONDUCTOR => 37, self::LYRICIST => 38, self::ORIGINAL_LYRICIST => 39, self::RADIO_STATION_NAME => 40, self::INFO_URL => 41, self::ARTIST_URL => 42, self::AUDIO_SOURCE_URL => 43, self::RADIO_STATION_URL => 44, self::BUY_THIS_URL => 45, self::ISRC_NUMBER => 46, self::CATALOG_NUMBER => 47, self::ORIGINAL_ARTIST => 48, self::COPYRIGHT => 49, self::REPORT_DATETIME => 50, self::REPORT_LOCATION => 51, self::REPORT_ORGANIZATION => 52, self::SUBJECT => 53, self::CONTRIBUTOR => 54, self::LANGUAGE => 55, self::FILE_EXISTS => 56, self::SOUNDCLOUD_ID => 57, self::SOUNDCLOUD_ERROR_CODE => 58, self::SOUNDCLOUD_ERROR_MSG => 59, self::SOUNDCLOUD_LINK_TO_FILE => 60, self::SOUNDCLOUD_UPLOAD_TIME => 61, self::REPLAY_GAIN => 62, self::OWNER_ID => 63, self::CUEIN => 64, self::CUEOUT => 65, self::HIDDEN => 66, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MIME' => 2, 'FTYPE' => 3, 'DIRECTORY' => 4, 'FILEPATH' => 5, 'STATE' => 6, 'CURRENTLYACCESSING' => 7, 'EDITEDBY' => 8, 'MTIME' => 9, 'UTIME' => 10, 'LPTIME' => 11, 'MD5' => 12, 'TRACK_TITLE' => 13, 'ARTIST_NAME' => 14, 'BIT_RATE' => 15, 'SAMPLE_RATE' => 16, 'FORMAT' => 17, 'LENGTH' => 18, 'ALBUM_TITLE' => 19, 'GENRE' => 20, 'COMMENTS' => 21, 'YEAR' => 22, 'TRACK_NUMBER' => 23, 'CHANNELS' => 24, 'URL' => 25, 'BPM' => 26, 'RATING' => 27, 'ENCODED_BY' => 28, 'DISC_NUMBER' => 29, 'MOOD' => 30, 'LABEL' => 31, 'COMPOSER' => 32, 'ENCODER' => 33, 'CHECKSUM' => 34, 'LYRICS' => 35, 'ORCHESTRA' => 36, 'CONDUCTOR' => 37, 'LYRICIST' => 38, 'ORIGINAL_LYRICIST' => 39, 'RADIO_STATION_NAME' => 40, 'INFO_URL' => 41, 'ARTIST_URL' => 42, 'AUDIO_SOURCE_URL' => 43, 'RADIO_STATION_URL' => 44, 'BUY_THIS_URL' => 45, 'ISRC_NUMBER' => 46, 'CATALOG_NUMBER' => 47, 'ORIGINAL_ARTIST' => 48, 'COPYRIGHT' => 49, 'REPORT_DATETIME' => 50, 'REPORT_LOCATION' => 51, 'REPORT_ORGANIZATION' => 52, 'SUBJECT' => 53, 'CONTRIBUTOR' => 54, 'LANGUAGE' => 55, 'FILE_EXISTS' => 56, 'SOUNDCLOUD_ID' => 57, 'SOUNDCLOUD_ERROR_CODE' => 58, 'SOUNDCLOUD_ERROR_MSG' => 59, 'SOUNDCLOUD_LINK_TO_FILE' => 60, 'SOUNDCLOUD_UPLOAD_TIME' => 61, 'REPLAY_GAIN' => 62, 'OWNER_ID' => 63, 'CUEIN' => 64, 'CUEOUT' => 65, 'HIDDEN' => 66, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mime' => 2, 'ftype' => 3, 'directory' => 4, 'filepath' => 5, 'state' => 6, 'currentlyaccessing' => 7, 'editedby' => 8, 'mtime' => 9, 'utime' => 10, 'lptime' => 11, 'md5' => 12, 'track_title' => 13, 'artist_name' => 14, 'bit_rate' => 15, 'sample_rate' => 16, 'format' => 17, 'length' => 18, 'album_title' => 19, 'genre' => 20, 'comments' => 21, 'year' => 22, 'track_number' => 23, 'channels' => 24, 'url' => 25, 'bpm' => 26, 'rating' => 27, 'encoded_by' => 28, 'disc_number' => 29, 'mood' => 30, 'label' => 31, 'composer' => 32, 'encoder' => 33, 'checksum' => 34, 'lyrics' => 35, 'orchestra' => 36, 'conductor' => 37, 'lyricist' => 38, 'original_lyricist' => 39, 'radio_station_name' => 40, 'info_url' => 41, 'artist_url' => 42, 'audio_source_url' => 43, 'radio_station_url' => 44, 'buy_this_url' => 45, 'isrc_number' => 46, 'catalog_number' => 47, 'original_artist' => 48, 'copyright' => 49, 'report_datetime' => 50, 'report_location' => 51, 'report_organization' => 52, 'subject' => 53, 'contributor' => 54, 'language' => 55, 'file_exists' => 56, 'soundcloud_id' => 57, 'soundcloud_error_code' => 58, 'soundcloud_error_msg' => 59, 'soundcloud_link_to_file' => 60, 'soundcloud_upload_time' => 61, 'replay_gain' => 62, 'owner_id' => 63, 'cuein' => 64, 'cueout' => 65, 'hidden' => 66, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, ) ); /** @@ -395,6 +404,9 @@ abstract class BaseCcFilesPeer { $criteria->addSelectColumn(CcFilesPeer::SOUNDCLOUD_UPLOAD_TIME); $criteria->addSelectColumn(CcFilesPeer::REPLAY_GAIN); $criteria->addSelectColumn(CcFilesPeer::OWNER_ID); + $criteria->addSelectColumn(CcFilesPeer::CUEIN); + $criteria->addSelectColumn(CcFilesPeer::CUEOUT); + $criteria->addSelectColumn(CcFilesPeer::HIDDEN); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.NAME'); @@ -460,6 +472,9 @@ abstract class BaseCcFilesPeer { $criteria->addSelectColumn($alias . '.SOUNDCLOUD_UPLOAD_TIME'); $criteria->addSelectColumn($alias . '.REPLAY_GAIN'); $criteria->addSelectColumn($alias . '.OWNER_ID'); + $criteria->addSelectColumn($alias . '.CUEIN'); + $criteria->addSelectColumn($alias . '.CUEOUT'); + $criteria->addSelectColumn($alias . '.HIDDEN'); } } diff --git a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php index 0599719ac..074a7dc46 100644 --- a/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php +++ b/airtime_mvc/application/models/airtime/om/BaseCcFilesQuery.php @@ -70,6 +70,9 @@ * @method CcFilesQuery orderByDbSoundCloundUploadTime($order = Criteria::ASC) Order by the soundcloud_upload_time column * @method CcFilesQuery orderByDbReplayGain($order = Criteria::ASC) Order by the replay_gain column * @method CcFilesQuery orderByDbOwnerId($order = Criteria::ASC) Order by the owner_id column + * @method CcFilesQuery orderByDbCuein($order = Criteria::ASC) Order by the cuein column + * @method CcFilesQuery orderByDbCueout($order = Criteria::ASC) Order by the cueout column + * @method CcFilesQuery orderByDbHidden($order = Criteria::ASC) Order by the hidden column * * @method CcFilesQuery groupByDbId() Group by the id column * @method CcFilesQuery groupByDbName() Group by the name column @@ -135,6 +138,9 @@ * @method CcFilesQuery groupByDbSoundCloundUploadTime() Group by the soundcloud_upload_time column * @method CcFilesQuery groupByDbReplayGain() Group by the replay_gain column * @method CcFilesQuery groupByDbOwnerId() Group by the owner_id column + * @method CcFilesQuery groupByDbCuein() Group by the cuein column + * @method CcFilesQuery groupByDbCueout() Group by the cueout column + * @method CcFilesQuery groupByDbHidden() Group by the hidden column * * @method CcFilesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcFilesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -235,6 +241,9 @@ * @method CcFiles findOneByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return the first CcFiles filtered by the soundcloud_upload_time column * @method CcFiles findOneByDbReplayGain(string $replay_gain) Return the first CcFiles filtered by the replay_gain column * @method CcFiles findOneByDbOwnerId(int $owner_id) Return the first CcFiles filtered by the owner_id column + * @method CcFiles findOneByDbCuein(string $cuein) Return the first CcFiles filtered by the cuein column + * @method CcFiles findOneByDbCueout(string $cueout) Return the first CcFiles filtered by the cueout column + * @method CcFiles findOneByDbHidden(boolean $hidden) Return the first CcFiles filtered by the hidden column * * @method array findByDbId(int $id) Return CcFiles objects filtered by the id column * @method array findByDbName(string $name) Return CcFiles objects filtered by the name column @@ -300,6 +309,9 @@ * @method array findByDbSoundCloundUploadTime(string $soundcloud_upload_time) Return CcFiles objects filtered by the soundcloud_upload_time column * @method array findByDbReplayGain(string $replay_gain) Return CcFiles objects filtered by the replay_gain column * @method array findByDbOwnerId(int $owner_id) Return CcFiles objects filtered by the owner_id column + * @method array findByDbCuein(string $cuein) Return CcFiles objects filtered by the cuein column + * @method array findByDbCueout(string $cueout) Return CcFiles objects filtered by the cueout column + * @method array findByDbHidden(boolean $hidden) Return CcFiles objects filtered by the hidden column * * @package propel.generator.airtime.om */ @@ -1951,6 +1963,67 @@ abstract class BaseCcFilesQuery extends ModelCriteria return $this->addUsingAlias(CcFilesPeer::OWNER_ID, $dbOwnerId, $comparison); } + /** + * Filter the query on the cuein column + * + * @param string $dbCuein The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbCuein($dbCuein = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbCuein)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbCuein)) { + $dbCuein = str_replace('*', '%', $dbCuein); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::CUEIN, $dbCuein, $comparison); + } + + /** + * Filter the query on the cueout column + * + * @param string $dbCueout The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbCueout($dbCueout = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbCueout)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbCueout)) { + $dbCueout = str_replace('*', '%', $dbCueout); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcFilesPeer::CUEOUT, $dbCueout, $comparison); + } + + /** + * Filter the query on the hidden column + * + * @param boolean|string $dbHidden The value to use as filter. + * Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcFilesQuery The current query, for fluid interface + */ + public function filterByDbHidden($dbHidden = null, $comparison = null) + { + if (is_string($dbHidden)) { + $hidden = in_array(strtolower($dbHidden), array('false', 'off', '-', 'no', 'n', '0')) ? false : true; + } + return $this->addUsingAlias(CcFilesPeer::HIDDEN, $dbHidden, $comparison); + } + /** * Filter the query by a related CcSubjs object * diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocale.php b/airtime_mvc/application/models/airtime/om/BaseCcLocale.php new file mode 100644 index 000000000..fdd4d43d8 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseCcLocale.php @@ -0,0 +1,764 @@ +id; + } + + /** + * Get the [locale_code] column value. + * + * @return string + */ + public function getDbLocaleCode() + { + return $this->locale_code; + } + + /** + * Get the [locale_lang] column value. + * + * @return string + */ + public function getDbLocaleLang() + { + return $this->locale_lang; + } + + /** + * Set the value of [id] column. + * + * @param int $v new value + * @return CcLocale The current object (for fluent API support) + */ + public function setDbId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = CcLocalePeer::ID; + } + + return $this; + } // setDbId() + + /** + * Set the value of [locale_code] column. + * + * @param string $v new value + * @return CcLocale The current object (for fluent API support) + */ + public function setDbLocaleCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->locale_code !== $v) { + $this->locale_code = $v; + $this->modifiedColumns[] = CcLocalePeer::LOCALE_CODE; + } + + return $this; + } // setDbLocaleCode() + + /** + * Set the value of [locale_lang] column. + * + * @param string $v new value + * @return CcLocale The current object (for fluent API support) + */ + public function setDbLocaleLang($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->locale_lang !== $v) { + $this->locale_lang = $v; + $this->modifiedColumns[] = CcLocalePeer::LOCALE_LANG; + } + + return $this; + } // setDbLocaleLang() + + /** + * 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->locale_code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->locale_lang = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 3; // 3 = CcLocalePeer::NUM_COLUMNS - CcLocalePeer::NUM_LAZY_LOAD_COLUMNS). + + } catch (Exception $e) { + throw new PropelException("Error populating CcLocale 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(CcLocalePeer::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 = CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $ret = $this->preDelete($con); + if ($ret) { + CcLocaleQuery::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(CcLocalePeer::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); + CcLocalePeer::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[] = CcLocalePeer::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(CcLocalePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::ID.')'); + } + + $pk = BasePeer::doInsert($criteria, $con); + $affectedRows = 1; + $this->setDbId($pk); //[IMV] update autoincrement primary key + $this->setNew(false); + } else { + $affectedRows = CcLocalePeer::doUpdate($this, $con); + } + + $this->resetModified(); // [HL] After being saved an object is no longer 'modified' + } + + $this->alreadyInSave = false; + + } + return $affectedRows; + } // doSave() + + /** + * Array of ValidationFailed objects. + * @var array ValidationFailed[] + */ + protected $validationFailures = array(); + + /** + * Gets any ValidationFailed objects that resulted from last call to validate(). + * + * + * @return array ValidationFailed[] + * @see validate() + */ + public function getValidationFailures() + { + return $this->validationFailures; + } + + /** + * Validates the objects modified field values and all objects related to this table. + * + * If $columns is either a column name or an array of column names + * only those columns are validated. + * + * @param mixed $columns Column name or an array of column names. + * @return boolean Whether all columns pass validation. + * @see doValidate() + * @see getValidationFailures() + */ + public function validate($columns = null) + { + $res = $this->doValidate($columns); + if ($res === true) { + $this->validationFailures = array(); + return true; + } else { + $this->validationFailures = $res; + return false; + } + } + + /** + * This function performs the validation work for complex object models. + * + * In addition to checking the current object, all related objects will + * also be validated. If all pass then true is returned; otherwise + * an aggreagated array of ValidationFailed objects will be returned. + * + * @param array $columns Array of column names to validate. + * @return mixed true if all validations pass; array of ValidationFailed objets otherwise. + */ + protected function doValidate($columns = null) + { + if (!$this->alreadyInValidation) { + $this->alreadyInValidation = true; + $retval = null; + + $failureMap = array(); + + + if (($retval = CcLocalePeer::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 = CcLocalePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + /** + * Retrieves a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @return mixed Value of field at $pos + */ + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getDbId(); + break; + case 1: + return $this->getDbLocaleCode(); + break; + case 2: + return $this->getDbLocaleLang(); + 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 = CcLocalePeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getDbId(), + $keys[1] => $this->getDbLocaleCode(), + $keys[2] => $this->getDbLocaleLang(), + ); + 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 = CcLocalePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + /** + * Sets a field from the object by Position as specified in the xml schema. + * Zero-based. + * + * @param int $pos position in xml schema + * @param mixed $value field value + * @return void + */ + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setDbId($value); + break; + case 1: + $this->setDbLocaleCode($value); + break; + case 2: + $this->setDbLocaleLang($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 = CcLocalePeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setDbLocaleCode($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setDbLocaleLang($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(CcLocalePeer::DATABASE_NAME); + + if ($this->isColumnModified(CcLocalePeer::ID)) $criteria->add(CcLocalePeer::ID, $this->id); + if ($this->isColumnModified(CcLocalePeer::LOCALE_CODE)) $criteria->add(CcLocalePeer::LOCALE_CODE, $this->locale_code); + if ($this->isColumnModified(CcLocalePeer::LOCALE_LANG)) $criteria->add(CcLocalePeer::LOCALE_LANG, $this->locale_lang); + + 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(CcLocalePeer::DATABASE_NAME); + $criteria->add(CcLocalePeer::ID, $this->id); + + return $criteria; + } + + /** + * Returns the primary key for this object (row). + * @return int + */ + public function getPrimaryKey() + { + return $this->getDbId(); + } + + /** + * Generic method to set the primary key (id column). + * + * @param int $key Primary key. + * @return void + */ + public function setPrimaryKey($key) + { + $this->setDbId($key); + } + + /** + * Returns true if the primary key for this object is null. + * @return boolean + */ + public function isPrimaryKeyNull() + { + return null === $this->getDbId(); + } + + /** + * Sets contents of passed object to values from current object. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param object $copyObj An object of CcLocale (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->setDbLocaleCode($this->locale_code); + $copyObj->setDbLocaleLang($this->locale_lang); + + $copyObj->setNew(true); + $copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value + } + + /** + * Makes a copy of this object that will be inserted as a new row in table when saved. + * It creates a new object filling in the simple attributes, but skipping any primary + * keys that are defined for the table. + * + * If desired, this method can also make copies of all associated (fkey referrers) + * objects. + * + * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row. + * @return CcLocale 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 CcLocalePeer + */ + public function getPeer() + { + if (self::$peer === null) { + self::$peer = new CcLocalePeer(); + } + return self::$peer; + } + + /** + * Clears the current object and sets all attributes to their default values + */ + public function clear() + { + $this->id = null; + $this->locale_code = null; + $this->locale_lang = 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); + } + +} // BaseCcLocale diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php new file mode 100644 index 000000000..eebb6a002 --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseCcLocalePeer.php @@ -0,0 +1,744 @@ + array ('DbId', 'DbLocaleCode', 'DbLocaleLang', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLocaleCode', 'dbLocaleLang', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::LOCALE_CODE, self::LOCALE_LANG, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOCALE_CODE', 'LOCALE_LANG', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'locale_code', 'locale_lang', ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * holds an array of keys for quick access to the fieldnames array + * + * first dimension keys are the type constants + * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 + */ + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLocaleCode' => 1, 'DbLocaleLang' => 2, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLocaleCode' => 1, 'dbLocaleLang' => 2, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOCALE_CODE => 1, self::LOCALE_LANG => 2, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOCALE_CODE' => 1, 'LOCALE_LANG' => 2, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'locale_code' => 1, 'locale_lang' => 2, ), + BasePeer::TYPE_NUM => array (0, 1, 2, ) + ); + + /** + * Translates a fieldname to another type + * + * @param string $name field name + * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @param string $toType One of the class type constants + * @return string translated name of the field. + * @throws PropelException - if the specified name could not be found in the fieldname mappings. + */ + static public function translateFieldName($name, $fromType, $toType) + { + $toNames = self::getFieldNames($toType); + $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null; + if ($key === null) { + throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true)); + } + return $toNames[$key]; + } + + /** + * Returns an array of field names. + * + * @param string $type The type of fieldnames to return: + * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME + * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM + * @return array A list of field names + */ + + static public function getFieldNames($type = BasePeer::TYPE_PHPNAME) + { + if (!array_key_exists($type, self::$fieldNames)) { + throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + /** + * Convenience method which changes table.column to alias.column. + * + * Using this method you can maintain SQL abstraction while using column aliases. + * + * $c->addAlias("alias1", TablePeer::TABLE_NAME); + * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN); + * + * @param string $alias The alias for the current table. + * @param string $column The column name for current table. (i.e. CcLocalePeer::COLUMN_NAME). + * @return string + */ + public static function alias($alias, $column) + { + return str_replace(CcLocalePeer::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(CcLocalePeer::ID); + $criteria->addSelectColumn(CcLocalePeer::LOCALE_CODE); + $criteria->addSelectColumn(CcLocalePeer::LOCALE_LANG); + } else { + $criteria->addSelectColumn($alias . '.ID'); + $criteria->addSelectColumn($alias . '.LOCALE_CODE'); + $criteria->addSelectColumn($alias . '.LOCALE_LANG'); + } + } + + /** + * 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(CcLocalePeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + CcLocalePeer::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(CcLocalePeer::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 CcLocale + * @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 = CcLocalePeer::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 CcLocalePeer::populateObjects(CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + CcLocalePeer::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 CcLocale $value A CcLocale object. + * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). + */ + public static function addInstanceToPool(CcLocale $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getDbId(); + } // if key === null + self::$instances[$key] = $obj; + } + } + + /** + * Removes an object from the instance pool. + * + * Propel keeps cached copies of objects in an instance pool when they are retrieved + * from the database. In some cases -- especially when you override doDelete + * methods in your stub classes -- you may need to explicitly remove objects + * from the cache in order to prevent returning objects that no longer exist. + * + * @param mixed $value A CcLocale object or a primary key value. + */ + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof CcLocale) { + $key = (string) $value->getDbId(); + } elseif (is_scalar($value)) { + // assume we've been passed a primary key + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcLocale 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 CcLocale 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_locale + * by a foreign key with ON DELETE CASCADE + */ + public static function clearRelatedInstancePool() + { + } + + /** + * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table. + * + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, a serialize()d version of the primary key will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return string A string version of PK or NULL if the components of primary key in result array are all null. + */ + public static function getPrimaryKeyHashFromRow($row, $startcol = 0) + { + // If the PK cannot be derived from the row, return NULL. + if ($row[$startcol] === null) { + return null; + } + return (string) $row[$startcol]; + } + + /** + * Retrieves the primary key from the DB resultset row + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with + * a multi-column primary key, an array of the primary key columns will be returned. + * + * @param array $row PropelPDO resultset row. + * @param int $startcol The 0-based offset for reading from the resultset row. + * @return mixed The primary key of the row + */ + public static function getPrimaryKeyFromRow($row, $startcol = 0) + { + return (int) $row[$startcol]; + } + + /** + * The returned array will contain objects of the default type or + * objects that inherit from the default. + * + * @throws PropelException Any exceptions caught during processing will be + * rethrown wrapped into a PropelException. + */ + public static function populateObjects(PDOStatement $stmt) + { + $results = array(); + + // set the class once to avoid overhead in the loop + $cls = CcLocalePeer::getOMClass(false); + // populate the object(s) + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = CcLocalePeer::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; + CcLocalePeer::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 (CcLocale object, last column rank) + */ + public static function populateObject($row, $startcol = 0) + { + $key = CcLocalePeer::getPrimaryKeyHashFromRow($row, $startcol); + if (null !== ($obj = CcLocalePeer::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 + CcLocalePeer::NUM_COLUMNS; + } else { + $cls = CcLocalePeer::OM_CLASS; + $obj = new $cls(); + $col = $obj->hydrate($row, $startcol); + CcLocalePeer::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(BaseCcLocalePeer::DATABASE_NAME); + if (!$dbMap->hasTable(BaseCcLocalePeer::TABLE_NAME)) + { + $dbMap->addTableObject(new CcLocaleTableMap()); + } + } + + /** + * 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 ? CcLocalePeer::CLASS_DEFAULT : CcLocalePeer::OM_CLASS; + } + + /** + * Method perform an INSERT on the database, given a CcLocale or Criteria object. + * + * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + } else { + $criteria = $values->buildCriteria(); // build Criteria from CcLocale object + } + + if ($criteria->containsKey(CcLocalePeer::ID) && $criteria->keyContainsValue(CcLocalePeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcLocalePeer::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 CcLocale or Criteria object. + * + * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; // rename for clarity + + $comparison = $criteria->getComparison(CcLocalePeer::ID); + $value = $criteria->remove(CcLocalePeer::ID); + if ($value) { + $selectCriteria->add(CcLocalePeer::ID, $value, $comparison); + } else { + $selectCriteria->setPrimaryTableName(CcLocalePeer::TABLE_NAME); + } + + } else { // $values is CcLocale 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_locale 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(CcLocalePeer::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(CcLocalePeer::TABLE_NAME, $con, CcLocalePeer::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). + CcLocalePeer::clearInstancePool(); + CcLocalePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Method perform a DELETE on the database, given a CcLocale or Criteria object OR a primary key value. + * + * @param mixed $values Criteria or CcLocale 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(CcLocalePeer::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. + CcLocalePeer::clearInstancePool(); + // rename for clarity + $criteria = clone $values; + } elseif ($values instanceof CcLocale) { // it's a model object + // invalidate the cache for this single object + CcLocalePeer::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(CcLocalePeer::ID, (array) $values, Criteria::IN); + // invalidate the cache for this object(s) + foreach ((array) $values as $singleval) { + CcLocalePeer::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); + CcLocalePeer::clearRelatedInstancePool(); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollBack(); + throw $e; + } + } + + /** + * Validates all modified columns of given CcLocale 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 CcLocale $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(CcLocale $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(CcLocalePeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, CcLocalePeer::TABLE_NAME, $columns); + } + + /** + * Retrieve a single object by pkey. + * + * @param int $pk the primary key. + * @param PropelPDO $con the connection to use + * @return CcLocale + */ + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(CcLocalePeer::DATABASE_NAME); + $criteria->add(CcLocalePeer::ID, $pk); + + $v = CcLocalePeer::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(CcLocalePeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(CcLocalePeer::DATABASE_NAME); + $criteria->add(CcLocalePeer::ID, $pks, Criteria::IN); + $objs = CcLocalePeer::doSelect($criteria, $con); + } + return $objs; + } + +} // BaseCcLocalePeer + +// This is the static code needed to register the TableMap for this table with the main Propel class. +// +BaseCcLocalePeer::buildTableMap(); + diff --git a/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php new file mode 100644 index 000000000..e12a5971b --- /dev/null +++ b/airtime_mvc/application/models/airtime/om/BaseCcLocaleQuery.php @@ -0,0 +1,217 @@ +setModelAlias($modelAlias); + } + if ($criteria instanceof Criteria) { + $query->mergeWith($criteria); + } + return $query; + } + + /** + * Find object by primary key + * Use instance pooling to avoid a database query if the object exists + * + * $obj = $c->findPk(12, $con); + * + * @param mixed $key Primary key to use for the query + * @param PropelPDO $con an optional connection object + * + * @return CcLocale|array|mixed the result, formatted by the current formatter + */ + public function findPk($key, $con = null) + { + if ((null !== ($obj = CcLocalePeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) { + // the object is alredy in the instance pool + return $obj; + } else { + // the object has not been requested yet, or the formatter is not an object formatter + $criteria = $this->isKeepQuery() ? clone $this : $this; + $stmt = $criteria + ->filterByPrimaryKey($key) + ->getSelectStatement($con); + return $criteria->getFormatter()->init($criteria)->formatOne($stmt); + } + } + + /** + * Find objects by primary key + * + * $objs = $c->findPks(array(12, 56, 832), $con); + * + * @param array $keys Primary keys to use for the query + * @param PropelPDO $con an optional connection object + * + * @return PropelObjectCollection|array|mixed the list of results, formatted by the current formatter + */ + public function findPks($keys, $con = null) + { + $criteria = $this->isKeepQuery() ? clone $this : $this; + return $this + ->filterByPrimaryKeys($keys) + ->find($con); + } + + /** + * Filter the query by primary key + * + * @param mixed $key Primary key to use for the query + * + * @return CcLocaleQuery The current query, for fluid interface + */ + public function filterByPrimaryKey($key) + { + return $this->addUsingAlias(CcLocalePeer::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 CcLocaleQuery The current query, for fluid interface + */ + public function filterByPrimaryKeys($keys) + { + return $this->addUsingAlias(CcLocalePeer::ID, $keys, Criteria::IN); + } + + /** + * Filter the query on the id column + * + * @param int|array $dbId The value to use as filter. + * Accepts an associative array('min' => $minValue, 'max' => $maxValue) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcLocaleQuery The current query, for fluid interface + */ + public function filterByDbId($dbId = null, $comparison = null) + { + if (is_array($dbId) && null === $comparison) { + $comparison = Criteria::IN; + } + return $this->addUsingAlias(CcLocalePeer::ID, $dbId, $comparison); + } + + /** + * Filter the query on the locale_code column + * + * @param string $dbLocaleCode 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 CcLocaleQuery The current query, for fluid interface + */ + public function filterByDbLocaleCode($dbLocaleCode = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLocaleCode)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLocaleCode)) { + $dbLocaleCode = str_replace('*', '%', $dbLocaleCode); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcLocalePeer::LOCALE_CODE, $dbLocaleCode, $comparison); + } + + /** + * Filter the query on the locale_lang column + * + * @param string $dbLocaleLang 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 CcLocaleQuery The current query, for fluid interface + */ + public function filterByDbLocaleLang($dbLocaleLang = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbLocaleLang)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbLocaleLang)) { + $dbLocaleLang = str_replace('*', '%', $dbLocaleLang); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcLocalePeer::LOCALE_LANG, $dbLocaleLang, $comparison); + } + + /** + * Exclude object from result + * + * @param CcLocale $ccLocale Object to remove from the list of results + * + * @return CcLocaleQuery The current query, for fluid interface + */ + public function prune($ccLocale = null) + { + if ($ccLocale) { + $this->addUsingAlias(CcLocalePeer::ID, $ccLocale->getDbId(), Criteria::NOT_EQUAL); + } + + return $this; + } + +} // BaseCcLocaleQuery diff --git a/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml b/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml index 0a04fb79c..e69de29bb 100644 --- a/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml +++ b/airtime_mvc/application/views/scripts/airtime-recorder/index.phtml @@ -1 +0,0 @@ -

View script for controller AirtimeRecorder and script/action name index
\ No newline at end of file diff --git a/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml b/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml index f76249b9f..e8196913f 100644 --- a/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml +++ b/airtime_mvc/application/views/scripts/audiopreview/audio-preview.phtml @@ -19,19 +19,19 @@ @@ -66,8 +66,10 @@ diff --git a/airtime_mvc/application/views/scripts/dashboard/about.phtml b/airtime_mvc/application/views/scripts/dashboard/about.phtml index b2ce0cb38..b104e83c7 100644 --- a/airtime_mvc/application/views/scripts/dashboard/about.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/about.phtml @@ -1,8 +1,21 @@
-

About

+

-Airtime airtime_version ?>, the open radio software for scheduling and remote station management.
-© 2012 Sourcefabric o.p.s. Airtime is distributed under the GNU GPL v.3 +", + "", + $this->airtime_version, + "
") +?> +
© 2012 +", + "", + "", + "") +?>


diff --git a/airtime_mvc/application/views/scripts/dashboard/help.phtml b/airtime_mvc/application/views/scripts/dashboard/help.phtml index 0ac5f80dc..66857c7cd 100644 --- a/airtime_mvc/application/views/scripts/dashboard/help.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/help.phtml @@ -1,15 +1,17 @@ - +
-

Welcome to Airtime!

-

Here's how you can get started using Airtime to automate your broadcasts:

+

+

    -
  1. Begin by adding your files to the library using the "Add Media" menu button. You can drag and drop your files to this window too.
  2. -
  3. Create a show by going to "Calendar" in the menu bar, and then clicking the "+ Show" icon. This can be either a one-time or repeating show. Only admins and program managers can add shows.
  4. -
  5. Add media to the show by going to your show in the Schedule calendar, left-clicking on it and selecting "Add / Remove Content".
  6. -
  7. Select your media from the left pane and drag them to your show in the right pane.
  8. +
  9. +
  10. +
  11. .
  12. +
-

Then you're good to go!
-For more detailed help, read the user manual.

+


+", + "") ?>

diff --git a/airtime_mvc/application/views/scripts/dashboard/index.phtml b/airtime_mvc/application/views/scripts/dashboard/index.phtml index e5b885fc7..e69de29bb 100644 --- a/airtime_mvc/application/views/scripts/dashboard/index.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/index.phtml @@ -1 +0,0 @@ -

View script for controller Dashboard and script/action name index
\ No newline at end of file diff --git a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml index ce4faa068..ac958fd0d 100644 --- a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml @@ -1,5 +1,6 @@