示例#1
0
 public function indexAction()
 {
     $form = new \DF\Form($this->current_module_config->forms->settings->form);
     $existing_settings = Settings::fetchArray(FALSE);
     $form->setDefaults($existing_settings);
     if (!empty($_POST) && $form->isValid($_POST)) {
         $data = $form->getValues();
         foreach ($data as $key => $value) {
             Settings::setSetting($key, $value);
         }
         Settings::clearCache();
         $this->alert('Settings updated!');
         return $this->redirectHere();
     }
     $this->renderForm($form, 'edit', 'Site Settings');
 }
示例#2
0
 public static function getSyncTimes()
 {
     Settings::clearCache();
     $syncs = array('nowplaying' => array('name' => 'Now Playing Data', 'latest' => Settings::getSetting('nowplaying_last_run', 0), 'contents' => array('Now Playing Data')), 'short' => array('name' => '1-Minute Sync', 'latest' => Settings::getSetting('sync_fast_last_run', 0), 'contents' => array('Schedule Notifications')), 'medium' => array('name' => '5-Minute Sync', 'latest' => Settings::getSetting('sync_last_run', 0), 'contents' => array('Homepage Tumblr Rotator', 'Station Schedules', 'Podcast Episodes', 'CentovaCast Metadata', 'Slim Player Cache')), 'long' => array('name' => '1-Hour Sync', 'latest' => Settings::getSetting('sync_slow_last_run', 0), 'contents' => array('Analytics and Statistics', 'Convention Archives', 'API Call Cleanup', 'Song History Cleanup', 'BronyTunes Sync', 'Pony.fm Sync', 'EqBeats Sync')));
     foreach ($syncs as $sync_key => $sync_info) {
         $sync_latest = $sync_info['latest'];
         $syncs[$sync_key]['diff'] = time() - $sync_latest;
         $syncs[$sync_key]['diff_text'] = \DF\Utilities::timeDifferenceText($sync_latest, time());
     }
     return $syncs;
 }