[QSL Labels] Added messages

这个提交包含在:
Andreas 2023-06-03 18:22:11 +02:00
父节点 946159b5d2
当前提交 e7d359f047
共有 2 个文件被更改,包括 43 次插入20 次删除

查看文件

@ -103,24 +103,29 @@ class Labels extends CI_Controller {
// Example of custom format // Example of custom format
// $pdf = new PDF_Label(array('paper-size'=>'A4', 'metric'=>'mm', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99, 'height'=>38, 'font-size'=>14)); // $pdf = new PDF_Label(array('paper-size'=>'A4', 'metric'=>'mm', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99, 'height'=>38, 'font-size'=>14));
if ($label) { try {
$pdf = new PDF_Label(array( if ($label) {
'paper-size' => $label->paper_type, $pdf = new PDF_Label(array(
'metric' => $label->metric, 'paper-size' => $label->paper_type,
'marginLeft' => $label->marginleft, 'metric' => $label->metric,
'marginTop' => $label->margintop, 'marginLeft' => $label->marginleft,
'NX' => $label->nx, 'marginTop' => $label->margintop,
'NY' => $label->ny, 'NX' => $label->nx,
'SpaceX' => $label->spacex, 'NY' => $label->ny,
'SpaceY' => $label->spacey, 'SpaceX' => $label->spacex,
'width' => $label->width, 'SpaceY' => $label->spacey,
'height' => $label->height, 'width' => $label->width,
'font-size' => $label->font_size 'height' => $label->height,
) 'font-size' => $label->font_size
); )
} else { );
// Standard format } else {
$pdf = new PDF_Label('3422'); // Standard format
$pdf = new PDF_Label('3422');
}
} catch (\Throwable $th) {
$this->session->set_flashdata('error', 'Something went wrong! The label could not be generated. Check label size and font size.');
redirect('labels');
} }
@ -142,7 +147,9 @@ class Labels extends CI_Controller {
} else { } else {
echo "0 results"; echo "0 results";
} }
$pdf->Output(); $pdf->Output();
} }
public function edit($id) { public function edit($id) {
@ -162,12 +169,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.');
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.');
redirect('labels'); redirect('labels');
} }

查看文件

@ -3,8 +3,22 @@
<br> <br>
<?php if($this->session->flashdata('message')) { ?> <?php if($this->session->flashdata('message')) { ?>
<!-- Display Message --> <!-- Display Message -->
<div class="alert-message error"> <div class="alert alert-success" role="alert">
<p><?php echo $this->session->flashdata('message'); ?></p> <?php echo $this->session->flashdata('message'); ?>
</div>
<?php } ?>
<?php if($this->session->flashdata('error')) { ?>
<!-- Display Message -->
<div class="alert alert-danger" role="alert">
<?php echo $this->session->flashdata('error'); ?>
</div>
<?php } ?>
<?php if($this->session->flashdata('warning')) { ?>
<!-- Display Message -->
<div class="alert alert-warning" role="alert">
<?php echo $this->session->flashdata('warning'); ?>
</div> </div>
<?php } ?> <?php } ?>