1 <?php
defined('SYSPATH') or die('No direct script access.');
3 * This helper is intended to be used to control
4 * the page reload (refresh) using javascript
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()) {
18 $refresh_key = 'config.page_refresh_rate';
19 $refresh = (int)config
::get($refresh_key, '*', true, true);
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 ?
>);
29 function refresh() {window
.location
.replace(sURL
);}
35 * Print javascript to control listview reload
39 public static function lv_control()
41 if (!Auth
::instance()->logged_in()) {
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
);