diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 26a6843c7..e64c74136 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -31,6 +31,7 @@ require_once "Auth.php"; require_once "interface/OAuth2.php"; require_once "TaskManager.php"; require_once "UsabilityHints.php"; +require_once "MediaType.php"; require_once __DIR__.'/models/formatters/LengthFormatter.php'; require_once __DIR__.'/services/CeleryService.php'; require_once __DIR__.'/services/SoundcloudService.php'; diff --git a/airtime_mvc/application/airtime-boot.php b/airtime_mvc/application/airtime-boot.php index 08a5b9869..5ed3cb4bc 100644 --- a/airtime_mvc/application/airtime-boot.php +++ b/airtime_mvc/application/airtime-boot.php @@ -36,6 +36,8 @@ set_include_path(implode(PATH_SEPARATOR, array( ))); set_include_path(APPLICATION_PATH . 'common' . PATH_SEPARATOR . get_include_path()); +set_include_path(APPLICATION_PATH . 'common/enum' . PATH_SEPARATOR . get_include_path()); +set_include_path(APPLICATION_PATH . 'common/interface' . PATH_SEPARATOR . get_include_path()); //Propel classes. set_include_path(APPLICATION_PATH . 'models' . PATH_SEPARATOR . get_include_path()); diff --git a/airtime_mvc/application/common/enum/Enum.php b/airtime_mvc/application/common/enum/Enum.php new file mode 100644 index 000000000..b0d34fbc3 --- /dev/null +++ b/airtime_mvc/application/common/enum/Enum.php @@ -0,0 +1,47 @@ +getConstants(); + } + return self::$constCacheArray[$calledClass]; + } + + public static function isValidName($name, $strict = false) { + $constants = self::getConstants(); + + if ($strict) { + return array_key_exists($name, $constants); + } + + $keys = array_map('strtolower', array_keys($constants)); + return in_array(strtolower($name), $keys); + } + + public static function isValidValue($value) { + $values = array_values(self::getConstants()); + return in_array($value, $values, $strict = true); + } + + public static function getDefault() { + return static::__default; + } + +} \ No newline at end of file diff --git a/airtime_mvc/application/common/enum/MediaType.php b/airtime_mvc/application/common/enum/MediaType.php new file mode 100644 index 000000000..69843c0d7 --- /dev/null +++ b/airtime_mvc/application/common/enum/MediaType.php @@ -0,0 +1,14 @@ +_service->upload($id); } + /** + * Download the file with the given id from a third-party service + * + * @return void + * + * @throws Zend_Controller_Response_Exception thrown if download fails for any reason + */ + public function downloadAction() { + $request = $this->getRequest(); + $id = $request->getParam('id'); + $this->_service->download($id); + } + /** * Delete the file with the given id from a third-party service * diff --git a/airtime_mvc/application/layouts/scripts/layout.phtml b/airtime_mvc/application/layouts/scripts/layout.phtml index e2e486415..83b55c87f 100644 --- a/airtime_mvc/application/layouts/scripts/layout.phtml +++ b/airtime_mvc/application/layouts/scripts/layout.phtml @@ -66,22 +66,21 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= - + - -
-
-
-
-
-
-
-
+ + + +