public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml')))); //enable soundcloud uploads $this->addElement('checkbox', 'UseSoundCloud', array('label' => _('Automatically Upload Recorded Shows'), 'required' => false, 'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(), 'decorators' => array('ViewHelper'))); //enable soundcloud uploads option $this->addElement('checkbox', 'UploadToSoundcloudOption', array('label' => _('Enable SoundCloud Upload'), 'required' => false, 'value' => Application_Model_Preference::GetUploadToSoundcloudOption(), 'decorators' => array('ViewHelper'))); //enable downloadable for soundcloud $this->addElement('checkbox', 'SoundCloudDownloadbleOption', array('label' => _('Automatically Mark Files "Downloadable" on SoundCloud'), 'required' => false, 'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(), 'decorators' => array('ViewHelper'))); //SoundCloud Username $this->addElement('text', 'SoundCloudUser', array('class' => 'input_text', 'label' => _('SoundCloud Email'), 'filters' => array('StringTrim'), 'autocomplete' => 'off', 'value' => Application_Model_Preference::GetSoundCloudUser(), 'decorators' => array('ViewHelper'), 'allowEmpty' => false, 'validators' => array(new ConditionalNotEmpty(array('UploadToSoundcloudOption' => '1'))))); //SoundCloud Password $this->addElement('password', 'SoundCloudPassword', array('class' => 'input_text', 'label' => _('SoundCloud Password'), 'filters' => array('StringTrim'), 'autocomplete' => 'off', 'value' => Application_Model_Preference::GetSoundCloudPassword(), 'decorators' => array('ViewHelper'), 'allowEmpty' => false, 'validators' => array(new ConditionalNotEmpty(array('UploadToSoundcloudOption' => '1'))), 'renderPassword' => true)); // Add the description element $this->addElement('textarea', 'SoundCloudTags', array('label' => _('SoundCloud Tags: (separate tags with spaces)'), 'required' => false, 'class' => 'input_text_area', 'value' => Application_Model_Preference::GetSoundCloudTags(), 'decorators' => array('ViewHelper'))); //SoundCloud default genre $this->addElement('text', 'SoundCloudGenre', array('class' => 'input_text', 'label' => _('Default Genre:'), 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudGenre(), 'decorators' => array('ViewHelper'))); $select = new Zend_Form_Element_Select('SoundCloudTrackType'); $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"))); $select->setRequired(false); $select->setValue(Application_Model_Preference::GetSoundCloudTrackType()); $select->setDecorators(array('ViewHelper')); $this->addElement($select); $select = new Zend_Form_Element_Select('SoundCloudLicense'); $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"))); $select->setRequired(false); $select->setValue(Application_Model_Preference::GetSoundCloudLicense()); $select->setDecorators(array('ViewHelper')); $this->addElement($select); }
public function startFrom() { $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')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); $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")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper')); if ($setting['output_sound_device'] != "true") { $output_type->setAttrib("disabled", "disabled"); } $this->addElement($output_type); } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $icecast_vorbis_metadata->setAttrib("readonly", true); } $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->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml')))); //enable soundcloud uploads $this->addElement('checkbox', 'UseSoundCloud', array('label' => 'Upload Recorded Shows To SoundCloud', 'required' => false, 'value' => Application_Model_Preference::GetDoSoundCloudUpload(), 'decorators' => array('ViewHelper'))); //SoundCloud Username $this->addElement('text', 'SoundCloudUser', array('class' => 'input_text', 'label' => 'SoundCloud Email:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudUser(), 'decorators' => array('ViewHelper'))); //SoundCloud Password $this->addElement('password', 'SoundCloudPassword', array('class' => 'input_text', 'label' => 'SoundCloud Password:'******'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudPassword(), 'decorators' => array('ViewHelper'))); // Add the description element $this->addElement('textarea', 'SoundCloudTags', array('label' => 'SoundCloud Tags: (separate tags with spaces)', 'required' => false, 'class' => 'input_text_area', 'value' => Application_Model_Preference::GetSoundCloudTags(), 'decorators' => array('ViewHelper'))); //SoundCloud default genre $this->addElement('text', 'SoundCloudGenre', array('class' => 'input_text', 'label' => 'Default Genre:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetSoundCloudGenre(), 'decorators' => array('ViewHelper'))); $select = new Zend_Form_Element_Select('SoundCloudTrackType'); $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")); $select->setRequired(false); $select->setValue(Application_Model_Preference::GetSoundCloudTrackType()); $select->setDecorators(array('ViewHelper')); $this->addElement($select); $select = new Zend_Form_Element_Select('SoundCloudLicense'); $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")); $select->setRequired(false); $select->setValue(Application_Model_Preference::GetSoundCloudLicense()); $select->setDecorators(array('ViewHelper')); $this->addElement($select); }
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); }
public function passwordRestoreAction() { global $CC_CONFIG; $request = $this->getRequest(); $baseUrl = $request->getBaseUrl(); $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'); } else { //uses separate layout without a navigation. $this->_helper->layout->setLayout('login'); $form = new Application_Form_PasswordRestore(); $request = $this->getRequest(); if ($request->isPost() && $form->isValid($request->getPost())) { if (is_null($form->username->getValue()) || $form->username->getValue() == '') { $user = CcSubjsQuery::create()->filterByDbEmail($form->email->getValue())->findOne(); } else { $user = CcSubjsQuery::create()->filterByDbEmail($form->email->getValue())->filterByDbLogin($form->username->getValue())->findOne(); } if (!empty($user)) { $auth = new Application_Model_Auth(); $success = $auth->sendPasswordRestoreLink($user, $this->view); 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.")); } } else { $form->email->addError($this->view->translate("Given email not found.")); } } $this->view->form = $form; } }
public function updateVariables() { $CC_CONFIG = Config::getConfig(); $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; $master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL(); $live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL(); $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url' => $master_dj_connection_url, 'live_dj_connection_url' => $live_dj_connection_url, 'isDemo' => $isDemo)))); }
public static function ShouldShowPopUp() { $today = mktime(0, 0, 0, date("m"), date("d"), date("Y")); $remindDate = Application_Model_Preference::GetRemindMeDate(); if ($remindDate == NULL || $today >= $remindDate) { return true; } }
public static function getDataPointsWithinRange($p_start, $p_end) { $sql = <<<SQL SELECT mount_name, count(*) FROM cc_listener_count AS lc INNER JOIN cc_timestamp AS ts ON (lc.timestamp_id = ts.ID) INNER JOIN cc_mount_name AS mn ON (lc.mount_name_id = mn.ID) WHERE (ts.timestamp >=:p1 AND ts.timestamp <=:p2) group by mount_name SQL; $data = Application_Common_Database::prepareAndExecute($sql, array('p1' => $p_start, 'p2' => $p_end)); $out = array(); foreach ($data as $d) { $jump = intval($d['count'] / 1000); $jump = max(1, $jump); $remainder = $jump == 1 ? 0 : 1; $sql = <<<SQL SELECT * FROM (SELECT lc.id, ts.timestamp, lc.listener_count, mn.mount_name, ROW_NUMBER() OVER (ORDER BY timestamp) as rownum FROM cc_listener_count AS lc INNER JOIN cc_timestamp AS ts ON (lc.timestamp_id = ts.ID) INNER JOIN cc_mount_name AS mn ON (lc.mount_name_id = mn.ID) WHERE (ts.timestamp >=:p1 AND ts.timestamp <= :p2) AND mount_name=:p3) as temp WHERE (temp.rownum%:p4) = :p5; SQL; $result = Application_Common_Database::prepareAndExecute($sql, array('p1' => $p_start, 'p2' => $p_end, 'p3' => $d['mount_name'], 'p4' => $jump, 'p5' => $remainder)); $utcTimezone = new DateTimeZone("UTC"); $displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone()); foreach ($result as $r) { $t = new DateTime($r['timestamp'], $utcTimezone); $t->setTimezone($displayTimezone); // tricking javascript so it thinks the server timezone is in UTC $dt = new DateTime($t->format("Y-m-d H:i:s"), $utcTimezone); $r['timestamp'] = $dt->format("U"); $out[$r['mount_name']][] = $r; } } $enabledStreamIds = Application_Model_StreamSetting::getEnabledStreamIds(); $enabledOut = array(); foreach ($enabledStreamIds as $sId) { $sql = "SELECT value FROM cc_stream_setting" . " WHERE keyname = :key"; $result = Application_Common_Database::prepareAndExecute($sql, array('key' => $sId . "_mount"), "single"); $enabledMountPoint = $result["value"]; if (isset($out[$enabledMountPoint])) { $enabledOut[$enabledMountPoint] = $out[$enabledMountPoint]; } else { //TODO fix this hack (here for CC-5254) //all shoutcast streams are automatically put under "shoutcast" mount point. if (isset($out["shoutcast"])) { $enabledOut["shoutcast"] = $out["shoutcast"]; } } } return $enabledOut; }
public function isTrial() { $plan = Application_Model_Preference::GetPlanLevel(); if ($plan == 'trial') { return true; } else { return false; } }
public function isSaas() { $plan = Application_Model_Preference::GetPlanLevel(); if ($plan == 'disabled') { return false; } else { return true; } }
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 indexAction() { $CC_CONFIG = Config::getConfig(); $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/i18n/' . $locale . '.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headLink()->appendStylesheet($baseUrl . 'css/plupload.queue.css?' . $CC_CONFIG['airtime_version']); }
public function isValid($value, $context = null) { $result = parent::isValid($value, $context); if (!$result) { // allow empty if username/email was set before and didn't change $storedUser = Application_Model_Preference::GetSoundCloudUser(); if ($storedUser != '' && $storedUser == $context['SoundCloudUser']) { return true; } } return $result; }
public function init() { $country_list = Application_Model_Preference::GetCountryList(); $isSass = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true; $this->isSass = $isSass; $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)), array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))); //Station name $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => true, 'filters' => array('StringTrim'), 'validator' => array('NotEmpty'), 'value' => Application_Model_Preference::GetStationName(), 'decorators' => array('ViewHelper'))); // Phone number $this->addElement('text', 'Phone', array('class' => 'input_text', 'label' => 'Phone:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), 'decorators' => array('ViewHelper'))); //Email $this->addElement('text', 'Email', array('class' => 'input_text', 'label' => 'Email:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), 'decorators' => array('ViewHelper'))); // Station Web Site $this->addElement('text', 'StationWebSite', array('label' => 'Station Web Site:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationWebSite(), 'decorators' => array('ViewHelper'))); // county list dropdown $this->addElement('select', 'Country', array('label' => 'Country:', 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, 'decorators' => array('ViewHelper'))); // Station city $this->addElement('text', 'City', array('label' => 'City:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), 'decorators' => array('ViewHelper'))); // Station Description $description = new Zend_Form_Element_Textarea('Description'); $description->class = 'input_text_area'; $description->setLabel('Station Description:')->setRequired(false)->setValue(Application_Model_Preference::GetStationDescription())->setDecorators(array('ViewHelper'))->setAttrib('ROWS', '2')->setAttrib('COLS', '58'); $this->addElement($description); // Station Logo $upload = new Zend_Form_Element_File('Logo'); $upload->setLabel('Station Logo:')->setRequired(false)->setDecorators(array('File'))->addValidator('Count', false, 1)->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addFilter('ImageSize'); $upload->setAttrib('accept', 'image/*'); $this->addElement($upload); if (!$isSass) { //enable support feedback $this->addElement('checkbox', 'SupportFeedback', array('label' => 'Send support feedback', 'required' => false, 'value' => Application_Model_Preference::GetSupportFeedback(), 'decorators' => array('ViewHelper'))); // checkbox for publicise $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')->setRequired(false)->setDecorators(array('ViewHelper'))->setValue(Application_Model_Preference::GetPublicise()); if (Application_Model_Preference::GetSupportFeedback() == '0') { $checkboxPublicise->setAttrib("disabled", "disabled"); } $this->addElement($checkboxPublicise); // text area for sending detail $this->addElement('textarea', 'SendInfo', array('class' => 'sending_textarea', 'required' => false, 'filters' => array('StringTrim'), 'readonly' => true, 'cols' => 61, 'rows' => 5, 'value' => Application_Model_Preference::GetSystemInfo(false, true), 'decorators' => array('ViewHelper'))); // checkbox for privacy policy $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")->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->setIgnore(true)->setLabel("Save")->setDecorators(array('ViewHelper')); $this->addElement($submit); }
public function trialRemaining() { $ending_date = Application_Model_Preference::GetTrialEndingDate(); if ($ending_date == '') { return ''; } $datetime1 = new DateTime(); $datetime2 = new DateTime($ending_date); $interval = $datetime1->diff($datetime2); if ($interval->format('%R') == '-') { return "Trial expired."; } return $interval->format('%a'); }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml')))); // Enable system emails $this->addElement('checkbox', 'enableSystemEmail', array('label' => _('Enable System Emails (Password Reset)'), 'required' => false, 'value' => Application_Model_Preference::GetEnableSystemEmail(), 'decorators' => array('ViewHelper'))); $this->addElement('text', 'systemEmail', array('class' => 'input_text', 'label' => _("Reset Password 'From' Email"), 'value' => Application_Model_Preference::GetSystemEmail(), 'readonly' => true, 'decorators' => array('viewHelper'))); $this->addElement('checkbox', 'configureMailServer', array('label' => _('Configure Mail Server'), 'required' => false, 'value' => Application_Model_Preference::GetMailServerConfigured(), 'decorators' => array('viewHelper'))); $this->addElement('checkbox', 'msRequiresAuth', array('label' => _('Requires Authentication'), 'required' => false, 'value' => Application_Model_Preference::GetMailServerRequiresAuth(), 'decorators' => array('viewHelper'))); $this->addElement('text', 'mailServer', array('class' => 'input_text', 'label' => _('Mail Server'), 'value' => Application_Model_Preference::GetMailServer(), 'readonly' => true, 'decorators' => array('viewHelper'), 'allowEmpty' => false, 'validators' => array(new ConditionalNotEmpty(array('configureMailServer' => '1'))))); $this->addElement('text', 'email', array('class' => 'input_text', 'label' => _('Email Address'), 'value' => Application_Model_Preference::GetMailServerEmailAddress(), 'readonly' => true, 'decorators' => array('viewHelper'), 'allowEmpty' => false, 'validators' => array(new ConditionalNotEmpty(array('configureMailServer' => '1', 'msRequiresAuth' => '1'))))); $this->addElement('password', 'ms_password', array('class' => 'input_text', 'label' => _('Password'), 'value' => Application_Model_Preference::GetMailServerPassword(), 'readonly' => true, 'decorators' => array('viewHelper'), 'allowEmpty' => false, 'validators' => array(new ConditionalNotEmpty(array('configureMailServer' => '1', 'msRequiresAuth' => '1'))), 'renderPassword' => true)); $port = new Zend_Form_Element_Text('port'); $port->class = 'input_text'; $port->setRequired(false)->setValue(Application_Model_Preference::GetMailServerPort())->setLabel(_('Port'))->setAttrib('readonly', true)->setDecorators(array('viewHelper')); $this->addElement($port); }
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, '../locale'); textdomain($domain); bind_textdomain_codeset($domain, $codeset); }
public static function SendMessageToShowRecorder($event_type) { $exchange = 'airtime-pypo'; $now = new DateTime("@" . time()); //in UTC timezone $end_timestamp = new DateTime("@" . (time() + 3600 * 2)); //in UTC timezone $temp = array(); $temp['event_type'] = $event_type; $temp['server_timezone'] = Application_Model_Preference::GetTimezone(); if ($event_type == "update_recorder_schedule") { $temp['shows'] = Application_Model_Show::getShows($now, $end_timestamp, $onlyRecord = true); } $data = json_encode($temp); self::sendMessage($exchange, $data); }
/** * Send email * * @param string $subject * @param string $message * @param mixed $tos * @return void */ public static function send($subject, $message, $tos, $from = null) { $mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false; $mailServerRequiresAuth = Application_Model_Preference::GetMailServerRequiresAuth() == true ? true : false; $success = true; if ($mailServerConfigured) { $mailServer = Application_Model_Preference::GetMailServer(); $mailServerPort = Application_Model_Preference::GetMailServerPort(); if (!empty($mailServerPort)) { $port = $mailServerPort; } if ($mailServerRequiresAuth) { $username = Application_Model_Preference::GetMailServerEmailAddress(); $password = Application_Model_Preference::GetMailServerPassword(); $config = array('auth' => 'login', 'ssl' => 'ssl', 'username' => $username, 'password' => $password); } else { $config = array('ssl' => 'tls'); } if (isset($port)) { $config['port'] = $port; } $transport = new Zend_Mail_Transport_Smtp($mailServer, $config); } $mail = new Zend_Mail('utf-8'); $mail->setSubject($subject); $mail->setBodyText($message); foreach ((array) $tos as $to) { $mail->addTo($to); } if ($mailServerConfigured) { $mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetMailServerEmailAddress()); try { $mail->send($transport); } catch (Exception $e) { $success = false; } } else { $mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetSystemEmail()); try { $mail->send(); } catch (Exception $e) { $success = false; } } return $success; }
public function init() { $this->setAction('/Preference'); $this->setMethod('post'); $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled' ? false : true; $this->isSaas = $isSaas; $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences.phtml', "isSaas" => $this->isSaas)))); $general_pref = new Application_Form_GeneralPreferences(); $this->addSubForm($general_pref, 'preferences_general'); if (!$isSaas) { $email_pref = new Application_Form_EmailServerPreferences(); $this->addSubForm($email_pref, 'preferences_email_server'); } $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'))); }
public function init() { $this->setAction('/Showbuilder'); $this->setMethod('post'); $country_list = Application_Model_Preference::GetCountryList(); $privacyChecked = false; if (Application_Model_Preference::GetPrivacyPolicyCheck() == 1) { $privacyChecked = true; } $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/register-dialog.phtml', 'privacyChecked' => $privacyChecked)), array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))); // Station Name $stnName = new Zend_Form_Element_Text("stnName"); $stnName->setLabel("Station Name")->setRequired(true)->setValue(Application_Model_Preference::GetStationName())->setDecorators(array('ViewHelper')); $this->addElement($stnName); // Phone number $this->addElement('text', 'Phone', array('class' => 'input_text', 'label' => 'Phone:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetPhone(), 'decorators' => array('ViewHelper'))); //Email $this->addElement('text', 'Email', array('class' => 'input_text', 'label' => 'Email:', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetEmail(), 'decorators' => array('ViewHelper'))); // Station Web Site $this->addElement('text', 'StationWebSite', array('label' => 'Station Web Site:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationWebSite(), 'decorators' => array('ViewHelper'))); // county list dropdown $this->addElement('select', 'Country', array('label' => 'Country:', 'required' => false, 'value' => Application_Model_Preference::GetStationCountry(), 'multiOptions' => $country_list, 'decorators' => array('ViewHelper'))); // Station city $this->addElement('text', 'City', array('label' => 'City:', 'required' => false, 'class' => 'input_text', 'value' => Application_Model_Preference::GetStationCity(), 'decorators' => array('ViewHelper'))); // Station Description $description = new Zend_Form_Element_Textarea('Description'); $description->class = 'input_text_area'; $description->setLabel('Station Description:')->setRequired(false)->setValue(Application_Model_Preference::GetStationDescription())->setDecorators(array('ViewHelper'))->setAttrib('ROWS', '2')->setAttrib('COLS', '58'); $this->addElement($description); // Station Logo $upload = new Zend_Form_Element_File('Logo'); $upload->setLabel('Station Logo:')->setRequired(false)->setDecorators(array('File'))->addValidator('Count', false, 1)->addValidator('Extension', false, 'jpg,jpeg,png,gif')->addFilter('ImageSize'); $this->addElement($upload); //enable support feedback $this->addElement('checkbox', 'SupportFeedback', array('label' => 'Send support feedback', 'required' => false, 'value' => 1, 'decorators' => array('ViewHelper'))); // checkbox for publicise $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); $checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')->setRequired(false)->setDecorators(array('ViewHelper'))->setValue(Application_Model_Preference::GetPublicise()); $this->addElement($checkboxPublicise); // text area for sending detail $this->addElement('textarea', 'SendInfo', array('class' => 'sending_textarea', 'required' => false, 'filters' => array('StringTrim'), 'readonly' => true, 'rows' => 5, 'cols' => 61, 'value' => Application_Model_Preference::GetSystemInfo(false, true), 'decorators' => array('ViewHelper'))); // checkbox for privacy policy $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")->setDecorators(array('ViewHelper')); $this->addElement($checkboxPrivacy); }
public function indexAction() { $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); $baseUrl = Application_Common_OsPath::getBaseDir(); //default time is the last 24 hours. $now = time(); $from = $request->getParam("from", $now - 24 * 60 * 60); $to = $request->getParam("to", $now); $utcTimezone = new DateTimeZone("UTC"); $displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone()); $start = DateTime::createFromFormat("U", $from, $utcTimezone); $start->setTimezone($displayTimeZone); $end = DateTime::createFromFormat("U", $to, $utcTimezone); $end->setTimezone($displayTimeZone); $form = new Application_Form_DateRange(); $form->populate(array('his_date_start' => $start->format("Y-m-d"), 'his_time_start' => $start->format("H:i"), 'his_date_end' => $end->format("Y-m-d"), 'his_time_end' => $end->format("H:i"))); $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-2.1.5/js/ZeroClipboard.js?' . $CC_CONFIG['airtime_version'], 'text/javascript'); $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/TableTools-2.1.5/js/TableTools.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/bootstrap-datetime/bootstrap-datetimepicker.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 . 'css/bootstrap-datetimepicker.min.css?' . $CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl . 'js/datatables/plugin/TableTools-2.1.5/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 . 'css/history_styles.css?' . $CC_CONFIG['airtime_version']); $this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.contextMenu.css?' . $CC_CONFIG['airtime_version']); //set datatables columns for display of data. $historyService = new Application_Service_HistoryService(); $columns = json_encode($historyService->getDatatablesLogSheetColumns()); $script = "localStorage.setItem( 'datatables-historyitem-aoColumns', JSON.stringify({$columns}) ); "; $columns = json_encode($historyService->getDatatablesFileSummaryColumns()); $script .= "localStorage.setItem( 'datatables-historyfile-aoColumns', JSON.stringify({$columns}) );"; $this->view->headScript()->appendScript($script); $user = Application_Model_User::getCurrentUser(); $this->view->userType = $user->getType(); }
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); }
public function uploadTrack($filepath, $filename, $description, $tags = array(), $release = null, $genre = null) { if ($this->getToken()) { if (count($tags)) { $tags = join(" ", $tags); $tags = $tags . " " . Application_Model_Preference::GetSoundCloudTags(); } else { $tags = Application_Model_Preference::GetSoundCloudTags(); } $downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1'; $track_data = array('track[sharing]' => 'private', 'track[title]' => $filename, 'track[asset_data]' => '@' . $filepath, 'track[tag_list]' => $tags, 'track[description]' => $description, 'track[downloadable]' => $downloadable); if (isset($release)) { $release = str_replace(" ", "-", $release); $release = str_replace(":", "-", $release); //YYYY-MM-DD-HH-mm-SS $release = explode("-", $release); $track_data['track[release_year]'] = $release[0]; $track_data['track[release_month]'] = $release[1]; $track_data['track[release_day]'] = $release[2]; } if (isset($genre) && $genre != "") { $track_data['track[genre]'] = $genre; } else { $default_genre = Application_Model_Preference::GetSoundCloudGenre(); if ($default_genre != "") { $track_data['track[genre]'] = $default_genre; } } $track_type = Application_Model_Preference::GetSoundCloudTrackType(); if ($track_type != "") { $track_data['track[track_type]'] = $track_type; } $license = Application_Model_Preference::GetSoundCloudLicense(); if ($license != "") { $track_data['track[license]'] = $license; } $response = json_decode($this->_soundcloud->post('tracks', $track_data), true); return $response; } else { throw new NoSoundCloundToken(); } }
public function __construct($id = null, $con = null) { if (isset($id)) { $this->block = CcBlockQuery::create()->findPk($id); if (is_null($this->block)) { throw new BlockNotFoundException(); } } else { $this->block = new CcBlock(); $this->block->setDbUTime(new DateTime("now", new DateTimeZone("UTC"))); $this->block->save(); } $defaultFade = Application_Model_Preference::GetDefaultFade(); if ($defaultFade !== "") { //fade is in format SS.uuuuuu $this->blockItem["fadein"] = $defaultFade; $this->blockItem["fadeout"] = $defaultFade; } $this->con = isset($con) ? $con : Propel::getConnection(CcBlockPeer::DATABASE_NAME); $this->id = $this->block->getDbId(); }
public function startFrom() { $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'))->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); $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"))->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper')); if ($setting['output_sound_device'] != "true") { $output_type->setAttrib("disabled", "disabled"); } $this->addElement($output_type); } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $icecast_vorbis_metadata->setAttrib("readonly", true); } $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->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 init() { $cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth"); $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:"))->setRequired(false)->setDecorators(array('ViewHelper')); $this->addElement($cb_custom_auth); //custom username $custom_username = new Zend_Form_Element_Text('custom_username'); $custom_username->setAttrib('class', 'input_text')->setAttrib('autocomplete', 'off')->setAllowEmpty(true)->setLabel(_('Custom Username'))->setFilters(array('StringTrim'))->setValidators(array(new ConditionalNotEmpty(array("cb_custom_auth" => "1"))))->setDecorators(array('ViewHelper')); $this->addElement($custom_username); //custom password $custom_password = new Zend_Form_Element_Password('custom_password'); $custom_password->setAttrib('class', 'input_text')->setAttrib('autocomplete', 'off')->setAttrib('renderPassword', 'true')->setAllowEmpty(true)->setLabel(_('Custom Password'))->setFilters(array('StringTrim'))->setValidators(array(new ConditionalNotEmpty(array("cb_custom_auth" => "1"))))->setDecorators(array('ViewHelper')); $this->addElement($custom_password); $connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL(); if (trim($connection_url) == "") { $connection_url = "N/A"; } $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url" => $connection_url)))); }
public function versionNotify() { if (Application_Model_Preference::GetPlanLevel() != 'disabled') { return ""; } // retrieve and validate current and latest versions, $current = Application_Model_Preference::GetAirtimeVersion(); $latest = Application_Model_Preference::GetLatestVersion(); $link = Application_Model_Preference::GetLatestLink(); $currentExploded = explode('.', $current); $latestExploded = explode('.', $latest); if (count($currentExploded) != 3 || count($latestExploded) != 3) { return ""; } // Calculate the version difference; // Example: if current = 1.9.5 and latest = 3.0.0, diff = 105 // Note: algorithm assumes the number after 1st dot never goes above 9 $versionDifference = intval($latestExploded[0]) * 100 + intval($latestExploded[1]) * 10 + intval($latestExploded[2]) - (intval($currentExploded[0]) * 100 + intval($currentExploded[1] * 10 + intval($currentExploded[2]))); // Pick icon based on distance this version is to the latest version available if ($versionDifference <= 0) { // current version is up to date or newer $class = "uptodate"; } else { if ($versionDifference < 20) { // 2 or less major versions back $class = "update"; } else { if ($versionDifference < 30) { // 3 major versions back $class = "update2"; } else { // more than 3 major versions back $class = "outdated"; } } } $result = "<div id='version-diff' style='display:none'>" . $versionDifference . "</div>" . "<div id='version-current' style='display:none'>" . $current . "</div>" . "<div id='version-latest' style='display:none'>" . $latest . "</div>" . "<div id='version-link' style='display:none'>" . $link . "</div>" . "<div id='version-icon' class='" . $class . "'></div>"; return $result; }
public function indexAction() { $CC_CONFIG = Config::getConfig(); $request = $this->getRequest(); $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/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']); //default time is the last 24 hours. $now = time(); $from = $request->getParam("from", $now - 24 * 60 * 60); $to = $request->getParam("to", $now); $utcTimezone = new DateTimeZone("UTC"); $displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone()); $start = DateTime::createFromFormat("U", $from, $utcTimezone); $start->setTimezone($displayTimeZone); $end = DateTime::createFromFormat("U", $to, $utcTimezone); $end->setTimezone($displayTimeZone); $form = new Application_Form_DateRange(); $form->populate(array('his_date_start' => $start->format("Y-m-d"), 'his_time_start' => $start->format("H:i"), 'his_date_end' => $end->format("Y-m-d"), '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; }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/preferences_general.phtml')))); $defaultFade = Application_Model_Preference::GetDefaultFade(); if ($defaultFade == "") { $defaultFade = '00:00:00.000000'; } //Station name $this->addElement('text', 'stationName', array('class' => 'input_text', 'label' => 'Station Name', 'required' => false, 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetValue("station_name"), 'decorators' => array('ViewHelper'))); //Default station fade $this->addElement('text', 'stationDefaultFade', array('class' => 'input_text', 'label' => 'Default Fade:', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', false, array('/^[0-2][0-3]:[0-5][0-9]:[0-5][0-9](\\.\\d{1,6})?$/', 'messages' => 'enter a time 00:00:00{.000000}'))), 'value' => $defaultFade, 'decorators' => array('ViewHelper'))); $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->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); $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); }