histogram: Make histograms crash less
[ninja.git] / application / helpers / refresh.php
blobd1d66c5fda65af3dfd0e35d61e4b07414816ae6d
1 <?php defined('SYSPATH') or die('No direct script access.');
2 /**
3 * This helper is intended to be used to control
4 * the page reload (refresh) using javascript
5 */
6 class refresh_Core {
8 /**
9 * Print javascript to control page reload
10 * Modified from http://grizzlyweb.com/webmaster/javascripts/refresh.asp
12 public static function control()
14 if (!Auth::instance()->logged_in()) {
15 return;
17 # fetch setting
18 $refresh_key = 'config.page_refresh_rate';
19 $refresh = (int)config::get($refresh_key, '*', true, true);
21 <script>
22 var _refresh_key = '<?php echo $refresh_key ?>';
23 var _refresh = '<?php echo $refresh ?>';
24 $(document).ready(function() {
25 $('#ninja_page_refresh_value').val(_refresh);
26 ninja_refresh(<?php echo $refresh ?>);
27 });
29 function refresh() {window.location.replace(sURL);}
30 </script>
31 <?php
34 /**
35 * Print javascript to control listview reload
37 * @return void
38 **/
39 public static function lv_control()
41 if (!Auth::instance()->logged_in()) {
42 return;
44 # fetch setting
45 $lv_refresh_key = 'config.listview_refresh_rate';
46 $lv_refresh = (int)config::get($lv_refresh_key, '*', true, true);
48 <script type="text/javascript">
49 _lv_refresh_key = '<?php echo $lv_refresh_key ?>';
50 _lv_refresh_delay = '<?php echo $lv_refresh ?>';
51 $(document).ready(function() {
52 $('#listview_refresh_value').val(_lv_refresh_delay);
53 });
54 </script>
55 <?php