mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Add grid check to station profiles add/edit as well
This commit is contained in:
@@ -32,6 +32,7 @@ class Station extends CI_Controller
|
||||
|
||||
$this->form_validation->set_rules('station_profile_name', 'Station Profile Name', 'required');
|
||||
$this->form_validation->set_rules('dxcc', 'DXCC', 'required');
|
||||
$this->form_validation->set_rules('gridsquare', 'Locator', 'callback_check_locator');
|
||||
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$data['page_title'] = __("Create Station Location");
|
||||
@@ -52,6 +53,7 @@ class Station extends CI_Controller
|
||||
$data['page_title'] = __("Edit Station Location: ") . $data['my_station_profile']->station_profile_name;
|
||||
|
||||
$this->form_validation->set_rules('dxcc', 'DXCC', 'required');
|
||||
$this->form_validation->set_rules('gridsquare', 'Locator', 'callback_check_locator');
|
||||
if ($this->form_validation->run() == FALSE) {
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('station_profile/edit');
|
||||
@@ -180,4 +182,14 @@ class Station extends CI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
function check_locator($grid = '') {
|
||||
$this->load->library('Qra');
|
||||
if ($this->qra->validate_grid($grid)) {
|
||||
return true;
|
||||
} else {
|
||||
$this->form_validation->set_message('check_locator', 'Please check value for grid locator ('.strtoupper($grid).').');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,20 @@ if ($dxcc_list->result() > 0) {
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->flashdata('notice')) { ?>
|
||||
<div id="message" >
|
||||
<?php echo $this->session->flashdata('notice'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php $this->load->helper('form'); ?>
|
||||
|
||||
<?php if(validation_errors()) { ?>
|
||||
<div class="alert alert-danger">
|
||||
<?php echo validation_errors(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<?php echo $page_title; ?>
|
||||
@@ -36,16 +50,6 @@ if ($dxcc_list->result() > 0) {
|
||||
<h5 class="card-title"></h5>
|
||||
<p class="card-text"></p>
|
||||
|
||||
<?php if($this->session->flashdata('notice')) { ?>
|
||||
<div id="message" >
|
||||
<?php echo $this->session->flashdata('notice'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php $this->load->helper('form'); ?>
|
||||
|
||||
<?php echo validation_errors(); ?>
|
||||
|
||||
<form method="post" action="<?php echo site_url('station/create'); ?>" name="create_profile">
|
||||
<div class="mb-3">
|
||||
<label for="stationNameInput"><?= __("Location Name"); ?></label>
|
||||
|
||||
@@ -43,7 +43,11 @@ if ($dxcc_list->result() > 0) {
|
||||
|
||||
<?php $this->load->helper('form'); ?>
|
||||
|
||||
<?php echo validation_errors(); ?>
|
||||
<?php if(validation_errors()) { ?>
|
||||
<div class="alert alert-danger">
|
||||
<?php echo validation_errors(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($my_station_profile->station_id != NULL) {
|
||||
$form_action = __("Update");
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
<?php if(validation_errors()) { ?>
|
||||
<div class="alert alert-danger">
|
||||
<a class="btn-close" data-bs-dismiss="alert">x</a>
|
||||
<?php echo validation_errors(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
Reference in New Issue
Block a user