コード例 #1
0
ファイル: GeneralPreferences.php プロジェクト: nidzix/Airtime
 public function init()
 {
     $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true;
     $this->isSaas = $isSaas;
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas))));
     $defaultFade = Application_Model_Preference::GetDefaultFade();
     if ($defaultFade == "") {
         $defaultFade = '0.500000';
     }
     //Station name
     $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper')));
     //Default station fade
     $this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade (s):', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-9]{1,2}(\\.\\d{1,6})?$/', 'messages' => 'enter a time in seconds 0{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper')));
     $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
     $third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (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);
     /* 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->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);
 }
コード例 #2
0
ファイル: ApiController.php プロジェクト: nidzix/Airtime
 /**
  * Sets up and send init values used in the Calendar.
  * This is only being used by schedule.js at the moment.
  */
 public function calendarInitAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     if (is_null(Zend_Auth::getInstance()->getStorage()->read())) {
         header('HTTP/1.0 401 Unauthorized');
         print 'You are not allowed to access this resource.';
         return;
     }
     $this->view->calendarInit = array("timestamp" => time(), "timezoneOffset" => date("Z"), "timeScale" => Application_Model_Preference::GetCalendarTimeScale(), "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(), "weekStartDay" => Application_Model_Preference::GetWeekStartDay());
 }
コード例 #3
0
ファイル: ScheduleController.php プロジェクト: nidzix/Airtime
 public function indexAction()
 {
     global $CC_CONFIG;
     $request = $this->getRequest();
     $baseUrl = $request->getBaseUrl();
     $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/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->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/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->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);
     $user = Application_Model_User::getCurrentUser();
     if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
         $this->view->preloadShowForm = true;
     }
     $this->view->headScript()->appendScript("var weekStart = " . Application_Model_Preference::GetWeekStartDay() . ";");
 }
コード例 #4
0
 public function indexAction()
 {
     $CC_CONFIG = Config::getConfig();
     $baseUrl = Application_Common_OsPath::getBaseDir();
     $this->view->headScript()->appendScript("var calendarPref = {};\n" . "calendarPref.weekStart = " . Application_Model_Preference::GetWeekStartDay() . ";\n" . "calendarPref.timestamp = " . time() . ";\n" . "calendarPref.timezoneOffset = " . Application_Common_DateHelper::getUserTimezoneOffset() . ";\n" . "calendarPref.timeScale = '" . Application_Model_Preference::GetCalendarTimeScale() . "';\n" . "calendarPref.timeInterval = " . Application_Model_Preference::GetCalendarTimeInterval() . ";\n" . "calendarPref.weekStartDay = " . Application_Model_Preference::GetWeekStartDay() . ";\n" . "var calendarEvents = null;");
     $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 should be as a default, however with our new drop down timezone changing for shows, we should reset this offset then??
     $this->view->headScript()->appendScript("var timezoneOffset = " . Application_Common_DateHelper::getStationTimezoneOffset() . "; //in seconds");
     //set offset to ensure it loads last
     $this->view->headScript()->offsetSetFile(90, $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/airtime/schedule/add-show.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->offsetSetFile(100, $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']);
     //Start Show builder JS/CSS requirements
     $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/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/showbuilder.css?' . $CC_CONFIG['airtime_version']);
     //End Show builder JS/CSS requirements
     $this->createShowFormAction(true);
     $user = Application_Model_User::getCurrentUser();
     if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
         $this->view->preloadShowForm = true;
     }
     $this->view->addNewShow = true;
 }
コード例 #5
0
 public function init()
 {
     $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
     $rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))));
     $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn();
     $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut();
     //Station name
     $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => _('Station Name'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper')));
     //Default station fade in
     $this->addElement('text', 'stationDefaultCrossfadeDuration', array('class' => 'input_text', 'label' => _('Default Crossfade Duration (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(), 'decorators' => array('ViewHelper')));
     //Default station fade in
     $this->addElement('text', 'stationDefaultFadeIn', array('class' => 'input_text', 'label' => _('Default Fade In (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => $defaultFadeIn, 'decorators' => array('ViewHelper')));
     //Default station fade out
     $this->addElement('text', 'stationDefaultFadeOut', array('class' => 'input_text', 'label' => _('Default Fade Out (s):'), 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array($rangeValidator, $notEmptyValidator, 'regex', false, array('/^[0-9]{1,2}(\\.\\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')))), 'value' => $defaultFadeOut, 'decorators' => array('ViewHelper')));
     $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
     $third_party_api->setLabel(sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '<br>'));
     $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);
     $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(_("Station 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->setMultiOptions($this->getWeekStartDays());
     $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
     $week_start_day->setDecorators(array('ViewHelper'));
     $this->addElement($week_start_day);
 }
コード例 #6
0
ファイル: Show.php プロジェクト: RadioCampusFrance/airtime
 public static function getStartEndCurrentWeekView()
 {
     $first_day_of_calendar_week_view = mktime(0, 0, 0, date("n"), date("j"));
     $weekStart = Application_Model_Preference::GetWeekStartDay();
     while (date('w', $first_day_of_calendar_week_view) != $weekStart) {
         $first_day_of_calendar_week_view -= 60 * 60 * 24;
     }
     $last_day_of_calendar_view = $first_day_of_calendar_week_view + 3600 * 24 * 7;
     $start = new DateTime("@" . $first_day_of_calendar_week_view);
     $end = new DateTime("@" . $last_day_of_calendar_view);
     return array($start, $end);
 }