[Labels] Added form to choose which label to start at

这个提交包含在:
Andreas 2023-07-29 20:02:18 +02:00
父节点 37281f8fe6
当前提交 aa051f7ffd
共有 4 个文件被更改,包括 59 次插入26 次删除

查看文件

@ -1,4 +1,4 @@
<?php <?php
require_once './src/Label/vendor/autoload.php'; require_once './src/Label/vendor/autoload.php';
use Cloudlog\Label\PDF_Label; use Cloudlog\Label\PDF_Label;
@ -12,7 +12,7 @@ class Labels extends CI_Controller {
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Controller: Labels | Controller: Labels
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This Controller handles all things Labels, creating, editing and printing | This Controller handles all things Labels, creating, editing and printing
| |
| |
@ -31,8 +31,8 @@ class Labels extends CI_Controller {
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Function: index | Function: index
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Nothing fancy just shows the main display of how many labels are waiting | Nothing fancy just shows the main display of how many labels are waiting
| to be printed per station profile. | to be printed per station profile.
| |
*/ */
@ -60,7 +60,7 @@ class Labels extends CI_Controller {
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Function: create | Function: create
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Shows the form used to create a label type. | Shows the form used to create a label type.
| |
*/ */
@ -79,7 +79,7 @@ class Labels extends CI_Controller {
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} }
else else
{ {
$this->load->model('labels_model'); $this->load->model('labels_model');
$this->labels_model->addLabel(); $this->labels_model->addLabel();
@ -114,16 +114,16 @@ class Labels extends CI_Controller {
try { try {
if ($label) { if ($label) {
$pdf = new PDF_Label(array( $pdf = new PDF_Label(array(
'paper-size' => $label->paper_type, 'paper-size' => $label->paper_type,
'metric' => $label->metric, 'metric' => $label->metric,
'marginLeft' => $label->marginleft, 'marginLeft' => $label->marginleft,
'marginTop' => $label->margintop, 'marginTop' => $label->margintop,
'NX' => $label->nx, 'NX' => $label->nx,
'NY' => $label->ny, 'NY' => $label->ny,
'SpaceX' => $label->spacex, 'SpaceX' => $label->spacex,
'SpaceY' => $label->spacey, 'SpaceY' => $label->spacey,
'width' => $label->width, 'width' => $label->width,
'height' => $label->height, 'height' => $label->height,
'font-size' => $label->font_size 'font-size' => $label->font_size
)); ));
} else { } else {
@ -132,7 +132,7 @@ class Labels extends CI_Controller {
echo json_encode(array('message' => 'You need to create a label and set it to be used for print.')); echo json_encode(array('message' => 'You need to create a label and set it to be used for print.'));
return; return;
} else { } else {
$this->session->set_flashdata('error', 'You need to create a label and set it to be used for print.'); $this->session->set_flashdata('error', 'You need to create a label and set it to be used for print.');
redirect('labels'); redirect('labels');
} }
} }
@ -142,7 +142,7 @@ class Labels extends CI_Controller {
echo json_encode(array('message' => 'Something went wrong! The label could not be generated. Check label size and font size.')); echo json_encode(array('message' => 'Something went wrong! The label could not be generated. Check label size and font size.'));
return; return;
} else { } else {
$this->session->set_flashdata('error', 'Something went wrong! The label could not be generated. Check label size and font size.'); $this->session->set_flashdata('error', 'Something went wrong! The label could not be generated. Check label size and font size.');
redirect('labels'); redirect('labels');
} }
} }
@ -165,7 +165,7 @@ class Labels extends CI_Controller {
$this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos); $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos);
} }
} else { } else {
$this->session->set_flashdata('message', '0 QSOs found for print!'); $this->session->set_flashdata('message', '0 QSOs found for print!');
redirect('labels'); redirect('labels');
} }
$pdf->Output(); $pdf->Output();
@ -268,14 +268,14 @@ class Labels extends CI_Controller {
public function updateLabel($id) { public function updateLabel($id) {
$this->load->model('labels_model'); $this->load->model('labels_model');
$this->labels_model->updateLabel($id); $this->labels_model->updateLabel($id);
$this->session->set_flashdata('message', 'Label was saved.'); $this->session->set_flashdata('message', 'Label was saved.');
redirect('labels'); redirect('labels');
} }
public function delete($id) { public function delete($id) {
$this->load->model('labels_model'); $this->load->model('labels_model');
$this->labels_model->deleteLabel($id); $this->labels_model->deleteLabel($id);
$this->session->set_flashdata('warning', 'Label was deleted.'); $this->session->set_flashdata('warning', 'Label was deleted.');
redirect('labels'); redirect('labels');
} }
@ -285,4 +285,8 @@ class Labels extends CI_Controller {
$this->labels_model->saveDefaultLabel($id); $this->labels_model->saveDefaultLabel($id);
} }
public function startAtLabel() {
$data['stationid'] = xss_clean(json_decode($this->input->post('stationid')));
$this->load->view('labels/startatform', $data);
}
} }

查看文件

@ -27,7 +27,7 @@
<div class="card-body"> <div class="card-body">
<a href="<?php echo site_url('labels/create'); ?>" class="btn btn-outline-primary btn-sm">Create New Label Type</a> <a href="<?php echo site_url('labels/create'); ?>" class="btn btn-outline-primary btn-sm">Create New Label Type</a>
<?php if ($labels) { <?php if ($labels) {
echo '<br/><br/>';?> echo '<br/><br/>';?>
@ -96,7 +96,7 @@
echo '<td>' . $qso->station_gridsquare . '</td>'; echo '<td>' . $qso->station_gridsquare . '</td>';
echo '<td>' . $qso->count . '</td>'; echo '<td>' . $qso->count . '</td>';
echo '<td><a href="'. site_url('qslprint') . '" class="btn btn-outline-info btn-sm"><i class="fas fa-search"></i></a></td>'; echo '<td><a href="'. site_url('qslprint') . '" class="btn btn-outline-info btn-sm"><i class="fas fa-search"></i></a></td>';
echo '<td><a href="'. site_url('labels/print/' . $qso->station_id) . '" class="btn btn-outline-success btn-sm"><i class="fas fa-print"></i></a></td>'; echo '<td><button class="btn btn-outline-success btn-sm printbutton" onclick="printat('.$qso->station_id.')"><i class="fas fa-print"></i></button></td>';
echo '</tr>'; echo '</tr>';
} ?> } ?>
</tbody> </tbody>
@ -105,4 +105,4 @@
</div> </div>
</div> </div>
</div> </div>

查看文件

@ -0,0 +1,4 @@
<form method="post" action="<?php echo site_url('labels/print/'.$stationid) ?>" class="form-inline">
<input class="form-control input-group-sm" type="number" id="startat" name="startat" value="1">
<button type="submit" id="button1id" name="button1id" class="btn btn-primary ld-ext-right">Print</button>
</form>

查看文件

@ -2,7 +2,7 @@ $('.labeltable').on('click', 'input[type="checkbox"]', function() {
var clickedlabelid = $(this).closest('tr').attr("class"); var clickedlabelid = $(this).closest('tr').attr("class");
clickedlabelid = clickedlabelid.match(/\d+/)[0]; clickedlabelid = clickedlabelid.match(/\d+/)[0];
saveDefault(clickedlabelid); saveDefault(clickedlabelid);
$('input:checkbox').not(this).prop('checked', false); $('input:checkbox').not(this).prop('checked', false);
}); });
function saveDefault(id) { function saveDefault(id) {
@ -13,4 +13,29 @@ function saveDefault(id) {
success: function (html) { success: function (html) {
} }
}); });
} }
function printat(stationid) {
$.ajax({
url: base_url + 'index.php/labels/startAtLabel',
type: 'post',
data: {'stationid': stationid},
success: function (html) {
BootstrapDialog.show({
title: 'Start printing at which label?',
size: BootstrapDialog.SIZE_NORMAL,
cssClass: 'qso-dialog',
nl2br: false,
message: html,
onshown: function(dialog) {
},
buttons: [{
label: 'Close',
action: function (dialogItself) {
dialogItself.close();
}
}]
});
}
});
}