diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index ec83929d..f4a68464 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -1,4 +1,4 @@ -load->view('interface_assets/footer'); } else - { + { $this->load->model('labels_model'); $this->labels_model->addLabel(); @@ -114,16 +114,16 @@ class Labels extends CI_Controller { try { if ($label) { $pdf = new PDF_Label(array( - 'paper-size' => $label->paper_type, - 'metric' => $label->metric, - 'marginLeft' => $label->marginleft, - 'marginTop' => $label->margintop, - 'NX' => $label->nx, - 'NY' => $label->ny, - 'SpaceX' => $label->spacex, - 'SpaceY' => $label->spacey, - 'width' => $label->width, - 'height' => $label->height, + 'paper-size' => $label->paper_type, + 'metric' => $label->metric, + 'marginLeft' => $label->marginleft, + 'marginTop' => $label->margintop, + 'NX' => $label->nx, + 'NY' => $label->ny, + 'SpaceX' => $label->spacex, + 'SpaceY' => $label->spacey, + 'width' => $label->width, + 'height' => $label->height, 'font-size' => $label->font_size )); } 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.')); return; } 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'); } } @@ -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.')); return; } 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'); } } @@ -165,7 +165,7 @@ class Labels extends CI_Controller { $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos); } } else { - $this->session->set_flashdata('message', '0 QSOs found for print!'); + $this->session->set_flashdata('message', '0 QSOs found for print!'); redirect('labels'); } $pdf->Output(); @@ -268,14 +268,14 @@ class Labels extends CI_Controller { public function updateLabel($id) { $this->load->model('labels_model'); $this->labels_model->updateLabel($id); - $this->session->set_flashdata('message', 'Label was saved.'); + $this->session->set_flashdata('message', 'Label was saved.'); redirect('labels'); } public function delete($id) { $this->load->model('labels_model'); $this->labels_model->deleteLabel($id); - $this->session->set_flashdata('warning', 'Label was deleted.'); + $this->session->set_flashdata('warning', 'Label was deleted.'); redirect('labels'); } @@ -285,4 +285,8 @@ class Labels extends CI_Controller { $this->labels_model->saveDefaultLabel($id); } + public function startAtLabel() { + $data['stationid'] = xss_clean(json_decode($this->input->post('stationid'))); + $this->load->view('labels/startatform', $data); + } } diff --git a/application/views/labels/index.php b/application/views/labels/index.php index 0b99b4b0..6e655133 100644 --- a/application/views/labels/index.php +++ b/application/views/labels/index.php @@ -27,7 +27,7 @@
Create New Label Type - +
';?> @@ -96,7 +96,7 @@ echo '' . $qso->station_gridsquare . ''; echo '' . $qso->count . ''; echo ''; - echo ''; + echo ''; echo ''; } ?> @@ -105,4 +105,4 @@
- \ No newline at end of file + diff --git a/application/views/labels/startatform.php b/application/views/labels/startatform.php new file mode 100644 index 00000000..15ba3b06 --- /dev/null +++ b/application/views/labels/startatform.php @@ -0,0 +1,4 @@ +
+ + +
diff --git a/assets/js/sections/labels.js b/assets/js/sections/labels.js index 62c6713f..d8f6d9be 100644 --- a/assets/js/sections/labels.js +++ b/assets/js/sections/labels.js @@ -2,7 +2,7 @@ $('.labeltable').on('click', 'input[type="checkbox"]', function() { var clickedlabelid = $(this).closest('tr').attr("class"); clickedlabelid = clickedlabelid.match(/\d+/)[0]; saveDefault(clickedlabelid); - $('input:checkbox').not(this).prop('checked', false); + $('input:checkbox').not(this).prop('checked', false); }); function saveDefault(id) { @@ -13,4 +13,29 @@ function saveDefault(id) { success: function (html) { } }); -} \ No newline at end of file +} + +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(); + } + }] + }); + } + }); +}