As per request of some users, sometimes new modes or missing modes had to be added into the code. As that hardcoded lists are not eary maintainable, we created a new table with all modes and submodes listed and make this list editable. Now one can activate or deativate modes from beeing shown within the select- list in QSO Window.
		
			
				
	
	
		
			61 行
		
	
	
		
			无行尾
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			61 行
		
	
	
		
			无行尾
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| class Modes extends CI_Model {
 | |
| 
 | |
|     function __construct()
 | |
|     {
 | |
|         // Call the Model constructor
 | |
|         parent::__construct();
 | |
|     }
 | |
| 
 | |
| 	function all() {
 | |
| 		return $this->db->get('adif_modes');
 | |
| 	}
 | |
| 	
 | |
| 	function active() {
 | |
| 		$this->db->where('active', 1);
 | |
| 		return $this->db->get('adif_modes');
 | |
| 	}
 | |
| 
 | |
| 	function mode($id) {
 | |
| 		// Clean ID
 | |
| 		$clean_id = $this->security->xss_clean($id);
 | |
| 
 | |
| 
 | |
| 		$this->db->where('id', $clean_id);
 | |
| 		return $this->db->get('adif_modes');
 | |
| 	}
 | |
| 
 | |
| 
 | |
| 	function add() {
 | |
| 		$data = array(
 | |
| 			'mode' => xss_clean($this->input->post('mode', true)),
 | |
| 			'qrgmode' =>  xss_clean(strtoupper($this->input->post('qrgmode', true))),
 | |
| 			'active' =>  xss_clean($this->input->post('active', true)),
 | |
| 		);
 | |
| 
 | |
| 		$this->db->insert('adif_modes', $data); 
 | |
| 	}
 | |
| 
 | |
| 	function edit() {
 | |
| 		$data = array(
 | |
| 			'mode' => xss_clean($this->input->post('mode', true)),
 | |
| 			'qrgmode' =>  xss_clean(strtoupper($this->input->post('qrgmode', true))),
 | |
| 			'active' =>  xss_clean($this->input->post('active', true)),
 | |
| 		);
 | |
| 
 | |
| 		$this->db->where('id', xss_clean($this->input->post('id', true)));
 | |
| 		$this->db->update('adif_modes', $data); 
 | |
| 	}
 | |
| 
 | |
| 	function delete($id) {
 | |
| 		// Clean ID
 | |
| 		$clean_id = $this->security->xss_clean($id);
 | |
| 
 | |
| 		// Delete Mode
 | |
| 		$this->db->delete('adif_modes', array('id' => $clean_id)); 
 | |
| 	}
 | |
| 
 | |
| }
 | |
| 
 | |
| ?>
 |