kopia lustrzana https://github.com/magicbug/Cloudlog
				
				
				
			[Bands] User settings can now be saved.
							rodzic
							
								
									b72ba539cf
								
							
						
					
					
						commit
						a9c6acf255
					
				| 
						 | 
				
			
			@ -90,7 +90,7 @@ class Awards extends CI_Controller {
 | 
			
		|||
        $this->load->model('modes');
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands('dxcc'); // Used in the view for band select
 | 
			
		||||
        $data['modes'] = $this->modes->active(); // Used in the view for mode select
 | 
			
		||||
 | 
			
		||||
        if ($this->input->post('band') != NULL) {   // Band is not set when page first loads.
 | 
			
		||||
| 
						 | 
				
			
			@ -156,7 +156,7 @@ class Awards extends CI_Controller {
 | 
			
		|||
    public function vucc()	{
 | 
			
		||||
        $this->load->model('vucc');
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands();
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands('vucc');
 | 
			
		||||
 | 
			
		||||
        $data['vucc_array'] = $this->vucc->get_vucc_array($data);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -249,7 +249,7 @@ class Awards extends CI_Controller {
 | 
			
		|||
		$this->load->model('modes');
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands();
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands('cq');
 | 
			
		||||
		$data['modes'] = $this->modes->active(); // Used in the view for mode select
 | 
			
		||||
 | 
			
		||||
        if ($this->input->post('band') != NULL) {   // Band is not set when page first loads.
 | 
			
		||||
| 
						 | 
				
			
			@ -307,7 +307,7 @@ class Awards extends CI_Controller {
 | 
			
		|||
		$this->load->model('modes');
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands();
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands('was');
 | 
			
		||||
		$data['modes'] = $this->modes->active(); // Used in the view for mode select
 | 
			
		||||
 | 
			
		||||
        if ($this->input->post('band') != NULL) {   // Band is not set when page first loads.
 | 
			
		||||
| 
						 | 
				
			
			@ -358,7 +358,7 @@ class Awards extends CI_Controller {
 | 
			
		|||
		$this->load->model('modes');
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
 | 
			
		||||
        $data['worked_bands'] = $this->bands->get_worked_bands('iota'); // Used in the view for band select
 | 
			
		||||
 | 
			
		||||
        if ($this->input->post('band') != NULL) {   // Band is not set when page first loads.
 | 
			
		||||
            if ($this->input->post('band') == 'All') {         // Did the user specify a band? If not, use all bands
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,4 +27,117 @@ class Band extends CI_Controller {
 | 
			
		|||
		$this->load->view('bands/index');
 | 
			
		||||
		$this->load->view('interface_assets/footer');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function create() 
 | 
			
		||||
	{
 | 
			
		||||
		$this->load->model('bands');
 | 
			
		||||
		$this->load->library('form_validation');
 | 
			
		||||
 | 
			
		||||
		$this->form_validation->set_rules('mode', 'Mode', 'required');
 | 
			
		||||
		$this->form_validation->set_rules('qrgmode', 'QRG-Mode', 'required');
 | 
			
		||||
 | 
			
		||||
		if ($this->form_validation->run() == FALSE)
 | 
			
		||||
		{
 | 
			
		||||
			$data['page_title'] = "Create Mode";
 | 
			
		||||
			$this->load->view('mode/create', $data);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{	
 | 
			
		||||
			$this->bands->add();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function edit($id)
 | 
			
		||||
	{
 | 
			
		||||
		$this->load->library('form_validation');
 | 
			
		||||
 | 
			
		||||
		$this->load->model('bands');
 | 
			
		||||
 | 
			
		||||
		$item_id_clean = $this->security->xss_clean($id);
 | 
			
		||||
 | 
			
		||||
		$mode_query = $this->bands->mode($item_id_clean);
 | 
			
		||||
 | 
			
		||||
		$data['my_mode'] = $mode_query->row();
 | 
			
		||||
		
 | 
			
		||||
		$data['page_title'] = "Edit Mode";
 | 
			
		||||
 | 
			
		||||
		$this->form_validation->set_rules('mode', 'Mode', 'required');
 | 
			
		||||
		$this->form_validation->set_rules('qrgmode', 'QRG-Mode', 'required');
 | 
			
		||||
		
 | 
			
		||||
        if ($this->form_validation->run() == FALSE)
 | 
			
		||||
        {
 | 
			
		||||
        	$this->load->view('interface_assets/header', $data);
 | 
			
		||||
            $this->load->view('mode/edit');
 | 
			
		||||
            $this->load->view('interface_assets/footer');
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            $this->bands->edit();
 | 
			
		||||
 | 
			
		||||
            $data['notice'] = "Mode ".$this->security->xss_clean($this->input->post('mode', true))." Updated";
 | 
			
		||||
 | 
			
		||||
            redirect('mode');
 | 
			
		||||
        }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function delete() {
 | 
			
		||||
	    $id = $this->input->post('id');
 | 
			
		||||
		$this->load->model('bands');
 | 
			
		||||
		$this->bands->delete($id);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public function activate() {
 | 
			
		||||
        $id = $this->input->post('id');
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
        $this->bands->activate($id);
 | 
			
		||||
        header('Content-Type: application/json');
 | 
			
		||||
        echo json_encode(array('message' => 'OK'));
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function deactivate() {
 | 
			
		||||
	    $id = $this->input->post('id');
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
        $this->bands->deactivate($id);
 | 
			
		||||
        header('Content-Type: application/json');
 | 
			
		||||
        echo json_encode(array('message' => 'OK'));
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public function activateall() {
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
        $this->bands->activateall();
 | 
			
		||||
        header('Content-Type: application/json');
 | 
			
		||||
        echo json_encode(array('message' => 'OK'));
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function deactivateall() {
 | 
			
		||||
        $this->load->model('bands');
 | 
			
		||||
        $this->bands->deactivateall();
 | 
			
		||||
        header('Content-Type: application/json');
 | 
			
		||||
        echo json_encode(array('message' => 'OK'));
 | 
			
		||||
		return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public function saveBand() {
 | 
			
		||||
		$id 				= $this->security->xss_clean($this->input->post('id'));
 | 
			
		||||
		$band['status'] 	= $this->security->xss_clean($this->input->post('status'));
 | 
			
		||||
		$band['cq'] 		= $this->security->xss_clean($this->input->post('cq'));
 | 
			
		||||
		$band['dok'] 		= $this->security->xss_clean($this->input->post('dok'));
 | 
			
		||||
		$band['dxcc'] 		= $this->security->xss_clean($this->input->post('dxcc'));
 | 
			
		||||
		$band['iota'] 		= $this->security->xss_clean($this->input->post('iota'));
 | 
			
		||||
		$band['sig'] 		= $this->security->xss_clean($this->input->post('sig'));
 | 
			
		||||
		$band['sota']		= $this->security->xss_clean($this->input->post('sota'));
 | 
			
		||||
		$band['uscounties'] = $this->security->xss_clean($this->input->post('uscounties'));
 | 
			
		||||
		$band['was'] 		= $this->security->xss_clean($this->input->post('was'));
 | 
			
		||||
		$band['vucc'] 		= $this->security->xss_clean($this->input->post('vucc'));
 | 
			
		||||
        
 | 
			
		||||
		$this->load->model('bands');
 | 
			
		||||
        $this->bands->saveBand($id, $band);
 | 
			
		||||
        
 | 
			
		||||
		header('Content-Type: application/json');
 | 
			
		||||
        echo json_encode(array('message' => 'OK'));
 | 
			
		||||
		return;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ class Bands extends CI_Model {
 | 
			
		|||
		$this->db->where('bandxuser.active', 1);
 | 
			
		||||
 | 
			
		||||
		if ($award != 'None') {
 | 
			
		||||
			$this->db->where('bandxuser.".$award', 1);
 | 
			
		||||
			$this->db->where('bandxuser.'.$award, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		$result = $this->db->get()->result();
 | 
			
		||||
| 
						 | 
				
			
			@ -90,6 +90,7 @@ class Bands extends CI_Model {
 | 
			
		|||
			array_push($worked_slots, strtoupper($row->COL_PROP_MODE));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// bring worked-slots in order of defined $bandslots
 | 
			
		||||
		$bandslots = $this->get_user_bands($award);
 | 
			
		||||
 | 
			
		||||
		$results = array();
 | 
			
		||||
| 
						 | 
				
			
			@ -122,12 +123,14 @@ class Bands extends CI_Model {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        // bring worked-slots in order of defined $bandslots
 | 
			
		||||
        $results = array();
 | 
			
		||||
        foreach(array_keys($this->bandslots) as $slot) {
 | 
			
		||||
            if(in_array($slot, $worked_slots)) {
 | 
			
		||||
                array_push($results, $slot);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
		$bandslots = $this->get_user_bands();
 | 
			
		||||
 | 
			
		||||
		$results = array();
 | 
			
		||||
		foreach($bandslots as $slot) {
 | 
			
		||||
			if(in_array($slot, $worked_slots)) {
 | 
			
		||||
				array_push($results, $slot);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
        return $results;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -175,10 +178,11 @@ class Bands extends CI_Model {
 | 
			
		|||
			array_push($worked_slots, $row->COL_BAND);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		// bring worked-slots in order of defined $bandslots
 | 
			
		||||
		$bandslots = $this->get_user_bands();
 | 
			
		||||
 | 
			
		||||
		$results = array();
 | 
			
		||||
		foreach(array_keys($this->bandslots) as $slot) {
 | 
			
		||||
		foreach($bandslots as $slot) {
 | 
			
		||||
			if(in_array($slot, $worked_slots)) {
 | 
			
		||||
				array_push($results, $slot);
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			@ -186,6 +190,58 @@ class Bands extends CI_Model {
 | 
			
		|||
		return $results;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function activateall() {
 | 
			
		||||
        $data = array(
 | 
			
		||||
            'active' => '1',
 | 
			
		||||
        );
 | 
			
		||||
		$this->db->where('bandxuser.userid', $this->session->userdata('user_id'));
 | 
			
		||||
 | 
			
		||||
        $this->db->update('bandxuser', $data);
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function deactivateall() {
 | 
			
		||||
        $data = array(
 | 
			
		||||
            'active' => '0',
 | 
			
		||||
        );
 | 
			
		||||
		$this->db->where('bandxuser.userid', $this->session->userdata('user_id'));
 | 
			
		||||
 | 
			
		||||
        $this->db->update('bandxuser', $data);
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	function delete($id) {
 | 
			
		||||
		// Clean ID
 | 
			
		||||
		$clean_id = $this->security->xss_clean($id);
 | 
			
		||||
 | 
			
		||||
		// Delete Mode
 | 
			
		||||
		$this->db->delete('bandxuser', array('id' => $clean_id)); 
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function saveBand($id, $band) {
 | 
			
		||||
        $data = array(
 | 
			
		||||
			'active' 	 => $band['status']		== "true" ? '1' : '0',
 | 
			
		||||
			'cq' 		 => $band['cq'] 		== "true" ? '1' : '0',
 | 
			
		||||
			'dok' 		 => $band['dok'] 		== "true" ? '1' : '0',
 | 
			
		||||
			'dxcc' 		 => $band['dxcc'] 		== "true" ? '1' : '0',
 | 
			
		||||
			'iota' 		 => $band['iota'] 		== "true" ? '1' : '0',
 | 
			
		||||
			'sig' 		 => $band['sig'] 		== "true" ? '1' : '0',
 | 
			
		||||
			'sota'		 => $band['sota'] 		== "true" ? '1' : '0',
 | 
			
		||||
			'uscounties' => $band['uscounties'] == "true" ? '1' : '0',
 | 
			
		||||
			'was' 		 => $band['was'] 		== "true" ? '1' : '0',
 | 
			
		||||
			'vucc'		 => $band['vucc'] 		== "true" ? '1' : '0'
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
		$this->db->where('bandxuser.userid', $this->session->userdata('user_id'));
 | 
			
		||||
        $this->db->where('bandxuser.id', $id);
 | 
			
		||||
 | 
			
		||||
        $this->db->update('bandxuser', $data);
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
| 
						 | 
				
			
			@ -23,64 +23,53 @@
 | 
			
		|||
	</p>
 | 
			
		||||
    <div class="table-responsive">
 | 
			
		||||
		
 | 
			
		||||
    <table style="width:100%" class="modetable table table-striped">
 | 
			
		||||
    <table style="width:100%" class="bandtable table table-striped">
 | 
			
		||||
			<thead>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<th class="select-filter" scope="col">Band</th>
 | 
			
		||||
					<th class="select-filter" scope="col">Status</th>
 | 
			
		||||
					<th scope="col">CQ</th>
 | 
			
		||||
                    <th scope="col">DOK</th>
 | 
			
		||||
                    <th scope="col">DXCC</th>
 | 
			
		||||
                    <th scope="col">IOTA</th>
 | 
			
		||||
					<th scope="col">SIG</th>
 | 
			
		||||
                    <th scope="col">SOTA</th>
 | 
			
		||||
                    <th scope="col">US Counties</th>
 | 
			
		||||
                    <th scope="col">WAS</th>
 | 
			
		||||
                    <th scope="col">VUCC</th>
 | 
			
		||||
                    <th scope="col"></th>
 | 
			
		||||
                    <th scope="col"></th>
 | 
			
		||||
                    <th scope="col"></th>
 | 
			
		||||
					<th>Band</th>
 | 
			
		||||
					<th>Active</th>
 | 
			
		||||
					<th>CQ</th>
 | 
			
		||||
                    <th>DOK</th>
 | 
			
		||||
                    <th>DXCC</th>
 | 
			
		||||
                    <th>IOTA</th>
 | 
			
		||||
					<th>SIG</th>
 | 
			
		||||
                    <th>SOTA</th>
 | 
			
		||||
                    <th>US Counties</th>
 | 
			
		||||
                    <th>WAS</th>
 | 
			
		||||
                    <th>VUCC</th>
 | 
			
		||||
                    <th></th>
 | 
			
		||||
                    <th></th>
 | 
			
		||||
                    <th></th>
 | 
			
		||||
 | 
			
		||||
				</tr>
 | 
			
		||||
			</thead>
 | 
			
		||||
			<tbody>
 | 
			
		||||
				<?php foreach ($bands as $band) { ?>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td><?php echo $band->band?></td>
 | 
			
		||||
                    <td><?php if ($band->active == 1) {echo 'Active';} else {echo 'Not Active';}; ?></td>
 | 
			
		||||
					<td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->cq == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->dok == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->dxcc == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->iota == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->sig == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->sota == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->uscounties == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->was == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td><div class="custom-control custom-checkbox"><input type="checkbox" class="custom-control-input" id="customCheck1" <?php if ($band->vucc == 1) {echo 'checked';}?>><label class="custom-control-label" for="customCheck1"></label></div></td>
 | 
			
		||||
                    <td style="text-align: center">
 | 
			
		||||
                        <button onclick='javascript:deactivateMode()' class=' btn btn-secondary btn-sm'>Deactivate</button>
 | 
			
		||||
                    </td>
 | 
			
		||||
					<td><?php echo $band->band;?></td>
 | 
			
		||||
                    <td class='band_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->active == 1) {echo 'checked';}?>></td>
 | 
			
		||||
					<td class='cq_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->cq == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='dok_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->dok == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='dxcc_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->dxcc == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='iota_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->iota == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='sig_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->sig == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='sota_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->sota == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='uscounties_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->uscounties == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='was_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->was == 1) {echo 'checked';}?>></td>
 | 
			
		||||
                    <td class='vucc_<?php echo $band->id ?>'><input type="checkbox" <?php if ($band->vucc == 1) {echo 'checked';}?>></td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<a href="<?php echo site_url('mode/edit')?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i> Edit</a>
 | 
			
		||||
						<a href="javascript:editBand('<?php echo $band->id ?>');" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i> Edit</a>
 | 
			
		||||
					</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<a href="javascript:deleteMode('');" class="btn btn-danger btn-sm" ><i class="fas fa-trash-alt"></i> Delete</a>
 | 
			
		||||
						<a href="javascript:deleteBand('<?php echo $band->id . '\',\'' . $band->band ?>');" class="btn btn-danger btn-sm" ><i class="fas fa-trash-alt"></i> Delete</a>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
						<a href="javascript:saveBand('<?php echo $band->id . '\',\'' . $band->band ?>');" class="btn btn-primary btn-sm" ><i class="fas fa-save"></i></i> Save</a>
 | 
			
		||||
                    </td>
 | 
			
		||||
				</tr>
 | 
			
		||||
 | 
			
		||||
				<?php } ?>
 | 
			
		||||
			</tbody>
 | 
			
		||||
			<tfoot>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<th></th>
 | 
			
		||||
					<th></th>
 | 
			
		||||
					<th></th>
 | 
			
		||||
					<th></th>
 | 
			
		||||
					<th></th>
 | 
			
		||||
					<th></th>
 | 
			
		||||
					<th></th>
 | 
			
		||||
				</tr>
 | 
			
		||||
			</tfoot>
 | 
			
		||||
		<table>
 | 
			
		||||
	</div>
 | 
			
		||||
  <br/>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2249,6 +2249,10 @@ $(document).ready(function(){
 | 
			
		|||
		<script src="<?php echo base_url(); ?>assets/js/sections/mode.js"></script>
 | 
			
		||||
    <?php } ?>
 | 
			
		||||
 | 
			
		||||
    <?php if ($this->uri->segment(1) == "band") { ?>
 | 
			
		||||
		<script src="<?php echo base_url(); ?>assets/js/sections/bands.js"></script>
 | 
			
		||||
    <?php } ?>
 | 
			
		||||
 | 
			
		||||
<?php if ($this->uri->segment(1) == "accumulated") { ?>
 | 
			
		||||
    <script src="<?php echo base_url(); ?>assets/js/chart.js"></script>
 | 
			
		||||
	<script src="<?php echo base_url(); ?>assets/js/sections/accumulatedstatistics.js"></script>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,163 @@
 | 
			
		|||
$('.bandtable').DataTable({
 | 
			
		||||
	"pageLength": 25,
 | 
			
		||||
	responsive: false,
 | 
			
		||||
	ordering: false,
 | 
			
		||||
	"scrollY": "500px",
 | 
			
		||||
	"scrollCollapse": true,
 | 
			
		||||
	"paging": false,
 | 
			
		||||
	"scrollX": true
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function createBandDialog() {
 | 
			
		||||
	$.ajax({
 | 
			
		||||
		url: base_url + 'index.php/band/create',
 | 
			
		||||
		type: 'post',
 | 
			
		||||
		success: function (html) {
 | 
			
		||||
			BootstrapDialog.show({
 | 
			
		||||
				title: 'Create band',
 | 
			
		||||
				size: BootstrapDialog.SIZE_WIDE,
 | 
			
		||||
				cssClass: 'create-band-dialog',
 | 
			
		||||
				nl2br: false,
 | 
			
		||||
				message: html,
 | 
			
		||||
				buttons: [{
 | 
			
		||||
					label: 'Close',
 | 
			
		||||
					action: function (dialogItself) {
 | 
			
		||||
						dialogItself.close();
 | 
			
		||||
					}
 | 
			
		||||
				}]
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function createBand(form) {
 | 
			
		||||
	if (form.mode.value != '') {
 | 
			
		||||
		$.ajax({
 | 
			
		||||
			url: base_url + 'index.php/band/create',
 | 
			
		||||
			type: 'post',
 | 
			
		||||
			data: {
 | 
			
		||||
				'band': form.band.value
 | 
			
		||||
			},
 | 
			
		||||
			success: function (html) {
 | 
			
		||||
				location.reload();
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function deactivateBand(bandid) {
 | 
			
		||||
	$.ajax({
 | 
			
		||||
		url: base_url + 'index.php/band/deactivate',
 | 
			
		||||
		type: 'post',
 | 
			
		||||
		data: { 'id': bandid },
 | 
			
		||||
		success: function (html) {
 | 
			
		||||
			$(".mode_" + modeid).text('not active');
 | 
			
		||||
			$('.btn_' + modeid).html('Activate');
 | 
			
		||||
			$('.btn_' + modeid).attr('onclick', 'activateMode(' + modeid + ')')
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function activateBand(bandid) {
 | 
			
		||||
	$.ajax({
 | 
			
		||||
		url: base_url + 'index.php/band/activate',
 | 
			
		||||
		type: 'post',
 | 
			
		||||
		data: { 'id': bandid },
 | 
			
		||||
		success: function (html) {
 | 
			
		||||
			$('.mode_' + modeid).text('active');
 | 
			
		||||
			$('.btn_' + modeid).html('Deactivate');
 | 
			
		||||
			$('.btn_' + modeid).attr('onclick', 'deactivateMode(' + modeid + ')')
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function deleteBand(id, band) {
 | 
			
		||||
	BootstrapDialog.confirm({
 | 
			
		||||
		title: 'DANGER',
 | 
			
		||||
		message: 'Warning! Are you sure you want to delete the following band: ' + band + '?',
 | 
			
		||||
		type: BootstrapDialog.TYPE_DANGER,
 | 
			
		||||
		closable: true,
 | 
			
		||||
		draggable: true,
 | 
			
		||||
		btnOKClass: 'btn-danger',
 | 
			
		||||
		callback: function (result) {
 | 
			
		||||
			if (result) {
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					url: base_url + 'index.php/band/delete',
 | 
			
		||||
					type: 'post',
 | 
			
		||||
					data: {
 | 
			
		||||
						'id': id
 | 
			
		||||
					},
 | 
			
		||||
					success: function (data) {
 | 
			
		||||
						$(".band_" + id).parent("tr:first").remove(); // removes mode from table
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function activateAllBands() {
 | 
			
		||||
	BootstrapDialog.confirm({
 | 
			
		||||
		title: 'DANGER',
 | 
			
		||||
		message: 'Warning! Are you sure you want to activate all bands?',
 | 
			
		||||
		type: BootstrapDialog.TYPE_DANGER,
 | 
			
		||||
		closable: true,
 | 
			
		||||
		draggable: true,
 | 
			
		||||
		btnOKClass: 'btn-danger',
 | 
			
		||||
		callback: function (result) {
 | 
			
		||||
			if (result) {
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					url: base_url + 'index.php/band/activateall',
 | 
			
		||||
					type: 'post',
 | 
			
		||||
					success: function (data) {
 | 
			
		||||
						location.reload();
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function deactivateAllBands() {
 | 
			
		||||
	BootstrapDialog.confirm({
 | 
			
		||||
		title: 'DANGER',
 | 
			
		||||
		message: 'Warning! Are you sure you want to deactivate all bands?',
 | 
			
		||||
		type: BootstrapDialog.TYPE_DANGER,
 | 
			
		||||
		closable: true,
 | 
			
		||||
		draggable: true,
 | 
			
		||||
		btnOKClass: 'btn-danger',
 | 
			
		||||
		callback: function (result) {
 | 
			
		||||
			if (result) {
 | 
			
		||||
				$.ajax({
 | 
			
		||||
					url: base_url + 'index.php/band/deactivateall',
 | 
			
		||||
					type: 'post',
 | 
			
		||||
					success: function (data) {
 | 
			
		||||
						location.reload();
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function saveBand(id) {
 | 
			
		||||
	$.ajax({
 | 
			
		||||
		url: base_url + 'index.php/band/saveBand',
 | 
			
		||||
		type: 'post',
 | 
			
		||||
		data: {'id': id,  
 | 
			
		||||
			'status': $(".band_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'cq': $(".cq_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'dok': $(".dok_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'dxcc': $(".dxcc_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'iota': $(".iota_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'sig': $(".sig_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'sota': $(".sota_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'uscounties': $(".uscounties_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'was': $(".was_"+id+" input[type='checkbox']").is(":checked"),
 | 
			
		||||
			'vucc': $(".vucc_"+id+" input[type='checkbox']").is(":checked")
 | 
			
		||||
		},
 | 
			
		||||
		success: function (html) {
 | 
			
		||||
			// Add an alert to say that it is saved. Vanish after 5 seconds.
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
}
 | 
			
		||||
		Ładowanie…
	
		Reference in New Issue