From b92793e80f0c6f3ed0f2d9b0464a0d06078043be Mon Sep 17 00:00:00 2001 From: james Date: Fri, 26 Aug 2011 15:41:20 -0400 Subject: [PATCH] CC-2727: Limit number of streams and max bitrate - create airtime-stream php script to set number of streams and max bitrate - the stream section itself is not displayed rather than grey out --- .../controllers/PreferenceController.php | 7 +- airtime_mvc/application/models/Preference.php | 18 +++- .../scripts/form/stream-setting-form.phtml | 2 +- airtime_mvc/build/sql/defaultdata.sql | 2 + utils/airtime-stream | 34 ++++++++ utils/airtime-stream.php | 87 +++++++++++++++++++ 6 files changed, 146 insertions(+), 4 deletions(-) create mode 100755 utils/airtime-stream create mode 100644 utils/airtime-stream.php diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 0dea51458..24be53d3e 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -139,12 +139,15 @@ class PreferenceController extends Zend_Controller_Action } $temp_bitrate = Application_Model_Preference::GetStreamBitrate(); + $max_bitrate = intval(Application_Model_Preference::GetMaxBitrate()); $stream_bitrates = array(); foreach ($temp_bitrate as $type){ - $stream_bitrates[trim($type)] = strtoupper(trim($type))." Kbit/s"; + if(intval($type) <= $max_bitrate){ + $stream_bitrates[trim($type)] = strtoupper(trim($type))." Kbit/s"; + } } - $num_of_stream = 3; + $num_of_stream = intval(Application_Model_Preference::GetNumOfStream()); $form = new Application_Form_StreamSetting(); $form->setSetting($setting); $form->startFrom(); diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index a71e46d8f..0bd171980 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -7,7 +7,7 @@ class Application_Model_Preference global $CC_CONFIG, $CC_DBC; //called from a daemon process - if(!Zend_Auth::getInstance()->hasIdentity()) { + if(!class_exists("Zend_Auth", false) || !Zend_Auth::getInstance()->hasIdentity()) { $id = NULL; } else { @@ -394,5 +394,21 @@ class Application_Model_Preference public static function GetPrivacyPolicyCheck(){ return Application_Model_Preference::GetValue("privacy_policy"); } + + public static function SetNumOfStream($num){ + Application_Model_Preference::SetValue("num_of_streams", intval($num)); + } + + public static function GetNumOfStream(){ + return Application_Model_Preference::GetValue("num_of_streams"); + } + + public static function SetMaxBitrate($bitrate){ + Application_Model_Preference::SetValue("max_bitrate", intval($bitrate)); + } + + public static function GetMaxBitrate(){ + return Application_Model_Preference::GetValue("max_bitrate"); + } } diff --git a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml index e51940ec5..e35d94408 100644 --- a/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml +++ b/airtime_mvc/application/views/scripts/form/stream-setting-form.phtml @@ -2,7 +2,7 @@ $s_name = "s".$this->stream_number; ?>

Stream stream_number?>

-
+