diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 82602021f..b25ba74fb 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -81,7 +81,8 @@ class ApiController extends Zend_Controller_Action "timestamp" => time(), "timezoneOffset" => date("Z"), "timeScale" => Application_Model_Preference::GetCalendarTimeScale(), - "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval() + "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(), + "weekStartDay" => Application_Model_Preference::GetWeekStartDay() ); } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index cc9080e53..ece06790e 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -36,6 +36,7 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]); 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::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]); Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]); diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 7b0da1400..61b79dbc8 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -65,6 +65,14 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $timezone->setValue(Application_Model_Preference::GetTimezone()); $timezone->setDecorators(array('ViewHelper')); $this->addElement($timezone); + + /* Form Element for setting which day is the start of the week */ + $week_start_day = new Zend_Form_Element_Select("weekStartDay"); + $week_start_day->setLabel("Week Starts On"); + $week_start_day->setMultiOptions($this->getWeekStartDays()); + $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay()); + $week_start_day->setDecorators(array('ViewHelper')); + $this->addElement($week_start_day); } private function getTimezones(){ @@ -90,7 +98,19 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm return $tzlist; } + - + private function getWeekStartDays() { + $days = array( + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday' + ); + return $days; + } } diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 7e7ab9334..200b4448f 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -485,6 +485,21 @@ class Application_Model_Preference public static function GetSoundCloudDownloadbleOption() { return self::GetValue("soundcloud_downloadable"); } + + public static function SetWeekStartDay($day) { + self::SetValue("week_start_day", $day); + } + + public static function GetWeekStartDay() { + $val = self::GetValue("week_start_day"); + if (strlen($val) == 0){ + return "0"; + } else { + return $val; + } + } + + /* User specific preferences start */ /** * Sets the time scale preference (day/week/month) in Calendar. @@ -533,5 +548,7 @@ class Application_Model_Preference public static function GetCalendarTimeInterval() { return self::GetValue("calendar_time_interval", true /* user specific */); } + + /* User specific preferences end */ } diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index 3c11ced5b..f8d7b23f7 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -72,7 +72,7 @@ - +
+ +
+
+ element->getElement('weekStartDay')->getValue(); + ?> + + + element->getElement('weekStartDay')->hasErrors()) : ?> + + +
diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 3f3445b52..5c7ee99f0 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -333,6 +333,7 @@ function createFullCalendar(data){ }, defaultView: getTimeScalePreference(data), slotMinutes: getTimeIntervalPreference(data), + firstDay: data.calendarInit.weekStartDay, editable: false, allDaySlot: false, axisFormat: 'H:mm',