Add frontend for SAT timers API
这个提交包含在:
		
							父节点
							
								
									2dad61ac35
								
							
						
					
					
						当前提交
						d498891013
					
				
					共有  3 个文件被更改,包括 78 次插入 和 1 次删除
				
			
		|  | @ -0,0 +1,26 @@ | |||
| <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | ||||
| 
 | ||||
| class Sattimers extends CI_Controller { | ||||
| 
 | ||||
| 	function __construct() { | ||||
| 		parent::__construct(); | ||||
| 
 | ||||
| 		$this->load->model('user_model'); | ||||
| 		if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } | ||||
| 	} | ||||
| 
 | ||||
|     public function index() { | ||||
|         $footerData = []; | ||||
|         $footerData['scripts'] = [ | ||||
|            'assets/js/sections/sattimers.js?' | ||||
|         ]; | ||||
|         $url = 'https://www.df2et.de/tevel/api.php'; | ||||
|         $json = file_get_contents($url); | ||||
|         $data['activations'] = json_decode($json, true); | ||||
| 
 | ||||
|         $data['page_title'] = "Satellite Timers"; | ||||
|         $this->load->view('interface_assets/header', $data); | ||||
|         $this->load->view('/sattimers/index', $data); | ||||
|         $this->load->view('interface_assets/footer', $footerData); | ||||
|     } | ||||
| } | ||||
|  | @ -42,6 +42,10 @@ | |||
| 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/datepicker.css" /> | ||||
| 	<?php } ?>
 | ||||
| 
 | ||||
| 	<?php if ($this->uri->segment(1) == "sattimers") { ?>
 | ||||
| 		<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/sattimers.css" /> | ||||
| 	<?php } ?>
 | ||||
| 
 | ||||
| 	<?php if (file_exists(APPPATH . '../assets/css/custom.css')) { | ||||
| 		echo '<link rel="stylesheet" href="' . base_url() . 'assets/css/custom.css">'; | ||||
| 	} ?>
 | ||||
|  | @ -101,6 +105,8 @@ | |||
| 									<div class="dropdown-divider"></div> | ||||
| 									<a class="dropdown-item" href="<?php echo site_url('bandmap/list'); ?>" title="Bandmap"><i class="fa fa-id-card"></i> <?php echo lang('menu_bandmap'); ?></a>
 | ||||
| 								<?php } ?>
 | ||||
| 									<div class="dropdown-divider"></div> | ||||
| 								<a class="dropdown-item" href="<?php echo site_url('sattimers'); ?>" title="SAT Timers"><i class="fas fa-satellite"></i> SAT Timers</a> | ||||
| 							</div> | ||||
| 						</li> | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,45 @@ | |||
| <div class="container"> | ||||
| <div class="table-responsive"> | ||||
| 
 | ||||
|     <h2>Satellite Timers</h2> | ||||
|     <p>This data is from <a target="_blank" href="https://www.df2et.de/tevel/">https://www.df2et.de/tevel/</a></p> | ||||
|     <script type="text/javascript"> | ||||
|         let dateArray = []; | ||||
|         dateArray.push(0); | ||||
|         <?php $i = 1; | ||||
|            foreach ($activations as $activation) : | ||||
|            if ($activation['timestamp'] != null) { | ||||
|               echo "var tevel".$i."Date = ".$activation['timestamp']." * 1000;\n"; | ||||
|               echo "dateArray.push(tevel".$i."Date);\n"; | ||||
|            } else { | ||||
|               echo "dateArray.push(0);\n"; | ||||
|            } | ||||
|            $i++; | ||||
|            endforeach; ?>
 | ||||
|         //var tevel11Date = new Date(new Date("2023-09-19T22:00:00.000Z").getTime());
 | ||||
|         //dateArray.push(tevel11Date);
 | ||||
| 
 | ||||
|     </script> | ||||
|     <table class="table table-striped table-hover"> | ||||
|         <thead> | ||||
|             <tr> | ||||
|                 <th>Satellite</th> | ||||
|                 <th colspan="2">Status</th> | ||||
|                 <th>Time-Out</th> | ||||
|             </tr> | ||||
|         </thead> | ||||
|         <tbody> | ||||
|             <?php $i = 1; ?>
 | ||||
|             <?php foreach ($activations as $activation) : ?>
 | ||||
|                 <tr> | ||||
|                 <td><span><?php echo $activation['sat']; ?></span></td>
 | ||||
|                 <td><span class="emoji" id="emoji<?php echo $i; ?>">n/a</span></td> | ||||
|                 <td><span id="tevel<?php echo $i; ?>Timer"></span></td> | ||||
|                 <td><span class="timeout" id="tevel<?php echo $i; ?>Timeout">...</span></td> | ||||
|                 </tr> | ||||
|             <?php $i++; ?>
 | ||||
|             <?php endforeach; ?>
 | ||||
|         </tbody> | ||||
|     </table> | ||||
| </div> | ||||
| </div> | ||||
		正在加载…
	
		在新工单中引用