63 行
		
	
	
		
			无行尾
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			63 行
		
	
	
		
			无行尾
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
class Qsl_model extends CI_Model {
 | 
						|
    function __construct()
 | 
						|
    {
 | 
						|
        // Call the Model constructor
 | 
						|
        parent::__construct();
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
    function getQsoWithQslList() {
 | 
						|
        $CI =& get_instance();
 | 
						|
        $CI->load->model('Stations');
 | 
						|
        $station_id = $CI->Stations->find_active();
 | 
						|
 | 
						|
        $this->db->select('*');
 | 
						|
        $this->db->from($this->config->item('table_name'));
 | 
						|
        $this->db->join('qsl_images', 'qsl_images.qsoid = ' . $this->config->item('table_name') . '.col_primary_key');
 | 
						|
        $this->db->where('station_id', $station_id);
 | 
						|
 | 
						|
        return $this->db->get();
 | 
						|
    }
 | 
						|
 | 
						|
    function getQslForQsoId($id) {
 | 
						|
        // Clean ID
 | 
						|
        $clean_id = $this->security->xss_clean($id);
 | 
						|
 | 
						|
        $this->db->select('*');
 | 
						|
        $this->db->from('qsl_images');
 | 
						|
        $this->db->where('qsoid', $clean_id);
 | 
						|
 | 
						|
        return $this->db->get()->result();
 | 
						|
    }
 | 
						|
 | 
						|
    function saveQsl($qsoid, $filename) {
 | 
						|
        $data = array(
 | 
						|
            'qsoid' => $qsoid,
 | 
						|
            'filename' => $filename
 | 
						|
        );
 | 
						|
 | 
						|
        $this->db->insert('qsl_images', $data);
 | 
						|
 | 
						|
        return $this->db->insert_id();
 | 
						|
    }
 | 
						|
 | 
						|
    function deleteQsl($id) {
 | 
						|
        // Clean ID
 | 
						|
        $clean_id = $this->security->xss_clean($id);
 | 
						|
 | 
						|
        // Delete Mode
 | 
						|
        $this->db->delete('qsl_images', array('id' => $clean_id));
 | 
						|
    }
 | 
						|
 | 
						|
    function getFilename($id) {
 | 
						|
        // Clean ID
 | 
						|
        $clean_id = $this->security->xss_clean($id);
 | 
						|
 | 
						|
        $this->db->select('filename');
 | 
						|
        $this->db->from('qsl_images');
 | 
						|
        $this->db->where('id', $clean_id);
 | 
						|
 | 
						|
        return $this->db->get();
 | 
						|
    }
 | 
						|
} |