kopia lustrzana https://github.com/magicbug/Cloudlog
Merge pull request #2367 from AndreasK79/labels_paper_types
Custom paper types for labelspull/2368/head
commit
b5bd9f86f6
|
@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$config['migration_version'] = 133;
|
$config['migration_version'] = 134;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -43,6 +43,8 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
$data['labels'] = $this->labels_model->fetchLabels($this->session->userdata('user_id'));
|
$data['labels'] = $this->labels_model->fetchLabels($this->session->userdata('user_id'));
|
||||||
|
|
||||||
|
$data['papertypes'] = $this->labels_model->fetchPapertypes($this->session->userdata('user_id'));
|
||||||
|
|
||||||
$data['qsos'] = $this->labels_model->fetchQsos($this->session->userdata('user_id'));
|
$data['qsos'] = $this->labels_model->fetchQsos($this->session->userdata('user_id'));
|
||||||
|
|
||||||
$footerData = [];
|
$footerData = [];
|
||||||
|
@ -69,6 +71,9 @@ class Labels extends CI_Controller {
|
||||||
$data['page_title'] = "Create Label Type";
|
$data['page_title'] = "Create Label Type";
|
||||||
|
|
||||||
$this->load->library('form_validation');
|
$this->load->library('form_validation');
|
||||||
|
$this->load->model('labels_model');
|
||||||
|
|
||||||
|
$data['papertypes'] = $this->labels_model->fetchPapertypes($this->session->userdata('user_id'));
|
||||||
|
|
||||||
$this->form_validation->set_rules('label_name', 'Label Name', 'required');
|
$this->form_validation->set_rules('label_name', 'Label Name', 'required');
|
||||||
|
|
||||||
|
@ -88,6 +93,43 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Function: createpaper
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Shows the form used to create a paper type.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
public function createpaper() {
|
||||||
|
|
||||||
|
$data['page_title'] = "Create Paper Type";
|
||||||
|
|
||||||
|
$this->load->library('form_validation');
|
||||||
|
|
||||||
|
$this->form_validation->set_rules('paper_name', 'Paper Name', 'required');
|
||||||
|
|
||||||
|
if ($this->form_validation->run() == FALSE)
|
||||||
|
{
|
||||||
|
$this->load->view('interface_assets/header', $data);
|
||||||
|
$this->load->view('labels/createpaper');
|
||||||
|
$this->load->view('interface_assets/footer');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->load->model('labels_model');
|
||||||
|
try {
|
||||||
|
$this->labels_model->addPaper();
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
$this->session->set_flashdata('error', 'Your paper could not be saved. Remember that it can\'t have the same name as existing paper types.');
|
||||||
|
redirect('labels/createpaper');
|
||||||
|
}
|
||||||
|
redirect('labels');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function printids() {
|
public function printids() {
|
||||||
$ids = xss_clean(json_decode($this->input->post('id')));
|
$ids = xss_clean(json_decode($this->input->post('id')));
|
||||||
$offset = xss_clean($this->input->post('startat'));
|
$offset = xss_clean($this->input->post('startat'));
|
||||||
|
@ -114,24 +156,38 @@ class Labels extends CI_Controller {
|
||||||
function prepareLabel($qsos, $jscall = false, $offset = 1) {
|
function prepareLabel($qsos, $jscall = false, $offset = 1) {
|
||||||
$this->load->model('labels_model');
|
$this->load->model('labels_model');
|
||||||
$label = $this->labels_model->getDefaultLabel();
|
$label = $this->labels_model->getDefaultLabel();
|
||||||
$label->font='DejaVuSans'; // Fix font to DejaVuSans
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($label) {
|
if ($label) {
|
||||||
$pdf = new PDF_Label(array(
|
$label->font='DejaVuSans'; // Fix font to DejaVuSans
|
||||||
'paper-size' => $label->paper_type,
|
$ptype=$this->labels_model->getPaperType($label->paper_type_id); // fetch papersize out of paper-table
|
||||||
'metric' => $label->metric,
|
if (($ptype->paper_id ?? '') != '') {
|
||||||
'marginLeft' => $label->marginleft,
|
$pdf = new PDF_Label(array(
|
||||||
'marginTop' => $label->margintop,
|
'paper-size' => 'custom', // $label->paper_type, // The only Type left is "custom" because A4 and so on are also defined at paper_types
|
||||||
'NX' => $label->nx,
|
'metric' => $label->metric,
|
||||||
'NY' => $label->ny,
|
'marginLeft' => $label->marginleft,
|
||||||
'SpaceX' => $label->spacex,
|
'marginTop' => $label->margintop,
|
||||||
'SpaceY' => $label->spacey,
|
'NX' => $label->nx,
|
||||||
'width' => $label->width,
|
'NY' => $label->ny,
|
||||||
'height' => $label->height,
|
'SpaceX' => $label->spacex,
|
||||||
'font-size' => $label->font_size
|
'SpaceY' => $label->spacey,
|
||||||
));
|
'width' => $label->width,
|
||||||
|
'height' => $label->height,
|
||||||
|
'font-size' => $label->font_size,
|
||||||
|
'pgX' => $ptype->width,
|
||||||
|
'pgY' => $ptype->height
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
if ($jscall) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(array('message' => 'You need to assign a paperType to the label before printing'));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$this->session->set_flashdata('error', 'You need to assign a paperType to the label before printing');
|
||||||
|
redirect('labels');
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($jscall) {
|
if ($jscall) {
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
@ -154,11 +210,11 @@ class Labels extends CI_Controller {
|
||||||
}
|
}
|
||||||
define('FPDF_FONTPATH', './src/Label/font/');
|
define('FPDF_FONTPATH', './src/Label/font/');
|
||||||
|
|
||||||
$pdf->AddPage();
|
$pdf->AddPage($ptype->orientation);
|
||||||
|
|
||||||
if ($label->font == 'DejaVuSans') { // leave this here, for future Use
|
if ($label->font == 'DejaVuSans') { // leave this here, for future Use
|
||||||
$pdf->AddFont($label->font,'','DejaVuSansMono.ttf',true);
|
$pdf->AddFont($label->font,'','DejaVuSansMono.ttf',true);
|
||||||
$pdf->SetFont($label->font);
|
$pdf->SetFont($label->font,'');
|
||||||
} else {
|
} else {
|
||||||
$pdf->AddFont($label->font);
|
$pdf->AddFont($label->font);
|
||||||
$pdf->SetFont($label->font);
|
$pdf->SetFont($label->font);
|
||||||
|
@ -166,9 +222,9 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
if ($qsos->num_rows() > 0) {
|
if ($qsos->num_rows() > 0) {
|
||||||
if ($label->qsos == 1) {
|
if ($label->qsos == 1) {
|
||||||
$this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset);
|
$this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation);
|
||||||
} else {
|
} else {
|
||||||
$this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset);
|
$this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->session->set_flashdata('message', '0 QSOs found for print!');
|
$this->session->set_flashdata('message', '0 QSOs found for print!');
|
||||||
|
@ -177,7 +233,7 @@ class Labels extends CI_Controller {
|
||||||
$pdf->Output();
|
$pdf->Output();
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset) {
|
function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation) {
|
||||||
$text = '';
|
$text = '';
|
||||||
$current_callsign = '';
|
$current_callsign = '';
|
||||||
$current_sat = '';
|
$current_sat = '';
|
||||||
|
@ -186,7 +242,7 @@ class Labels extends CI_Controller {
|
||||||
$qso_data = [];
|
$qso_data = [];
|
||||||
if ($offset !== 1) {
|
if ($offset !== 1) {
|
||||||
for ($i = 1; $i < $offset; $i++) {
|
for ($i = 1; $i < $offset; $i++) {
|
||||||
$pdf->Add_Label('');
|
$pdf->Add_Label('',$orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach($qsos as $qso) {
|
foreach($qsos as $qso) {
|
||||||
|
@ -194,7 +250,7 @@ class Labels extends CI_Controller {
|
||||||
( ($qso->COL_BAND_RX !== $current_sat_bandrx) && ($this->pretty_sat_mode($qso->COL_SAT_MODE) !== '')) ) {
|
( ($qso->COL_BAND_RX !== $current_sat_bandrx) && ($this->pretty_sat_mode($qso->COL_SAT_MODE) !== '')) ) {
|
||||||
// ((($qso->COL_SAT_NAME ?? '' !== $current_sat) || ($qso->COL_CALL !== $current_callsign)) && ($qso->COL_SAT_NAME ?? '' !== '') && ($col->COL_BAND_RX ?? '' !== $current_sat_bandrx))) {
|
// ((($qso->COL_SAT_NAME ?? '' !== $current_sat) || ($qso->COL_CALL !== $current_callsign)) && ($qso->COL_SAT_NAME ?? '' !== '') && ($col->COL_BAND_RX ?? '' !== $current_sat_bandrx))) {
|
||||||
if (!empty($qso_data)) {
|
if (!empty($qso_data)) {
|
||||||
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos);
|
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation);
|
||||||
$qso_data = [];
|
$qso_data = [];
|
||||||
}
|
}
|
||||||
$current_callsign = $qso->COL_CALL;
|
$current_callsign = $qso->COL_CALL;
|
||||||
|
@ -216,7 +272,7 @@ class Labels extends CI_Controller {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (!empty($qso_data)) {
|
if (!empty($qso_data)) {
|
||||||
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos);
|
$this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// New begin
|
// New begin
|
||||||
|
@ -224,7 +280,7 @@ class Labels extends CI_Controller {
|
||||||
return(strlen($sat_mode ?? '') == 2 ? (strtoupper($sat_mode[0]).'/'.strtoupper($sat_mode[1])) : strtoupper($sat_mode ?? ''));
|
return(strlen($sat_mode ?? '') == 2 ? (strtoupper($sat_mode[0]).'/'.strtoupper($sat_mode[1])) : strtoupper($sat_mode ?? ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label) {
|
function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation) {
|
||||||
|
|
||||||
$tableData = [];
|
$tableData = [];
|
||||||
$count_qso = 0;
|
$count_qso = 0;
|
||||||
|
@ -244,7 +300,7 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
|
|
||||||
if($count_qso == $qso_per_label){
|
if($count_qso == $qso_per_label){
|
||||||
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso);
|
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation);
|
||||||
$tableData = []; // reset the data
|
$tableData = []; // reset the data
|
||||||
$count_qso = 0; // reset the counter
|
$count_qso = 0; // reset the counter
|
||||||
}
|
}
|
||||||
|
@ -252,12 +308,12 @@ class Labels extends CI_Controller {
|
||||||
}
|
}
|
||||||
// generate label for remaining QSOs
|
// generate label for remaining QSOs
|
||||||
if($count_qso > 0){
|
if($count_qso > 0){
|
||||||
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso);
|
$this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation);
|
||||||
$preliminaryData = []; // reset the data
|
$preliminaryData = []; // reset the data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso){
|
function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation){
|
||||||
$builder = new \AsciiTable\Builder();
|
$builder = new \AsciiTable\Builder();
|
||||||
$builder->addRows($tableData);
|
$builder->addRows($tableData);
|
||||||
$text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with ";
|
$text = "Confirming QSO".($numofqsos>1 ? 's' : '')." with ";
|
||||||
|
@ -275,7 +331,7 @@ class Labels extends CI_Controller {
|
||||||
}
|
}
|
||||||
$text .= "\nThanks for the QSO".($numofqsos>1 ? 's' : '');
|
$text .= "\nThanks for the QSO".($numofqsos>1 ? 's' : '');
|
||||||
$text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL";
|
$text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL";
|
||||||
$pdf->Add_Label($text);
|
$pdf->Add_Label($text,$orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// New End
|
// New End
|
||||||
|
@ -285,7 +341,9 @@ class Labels extends CI_Controller {
|
||||||
|
|
||||||
$cleanid = $this->security->xss_clean($id);
|
$cleanid = $this->security->xss_clean($id);
|
||||||
|
|
||||||
$data['label'] = $this->labels_model->getLabel($cleanid);
|
$data['label'] = $this->labels_model->getLabel($cleanid,$this->session->userdata('user_id'));
|
||||||
|
|
||||||
|
$data['papertypes'] = $this->labels_model->fetchPapertypes($this->session->userdata('user_id'));
|
||||||
|
|
||||||
$data['page_title'] = "Edit Label";
|
$data['page_title'] = "Edit Label";
|
||||||
|
|
||||||
|
@ -318,4 +376,43 @@ class Labels extends CI_Controller {
|
||||||
$data['stationid'] = xss_clean($this->input->post('stationid'));
|
$data['stationid'] = xss_clean($this->input->post('stationid'));
|
||||||
$this->load->view('labels/startatform', $data);
|
$this->load->view('labels/startatform', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function editPaper($id) {
|
||||||
|
$this->load->model('labels_model');
|
||||||
|
|
||||||
|
$cleanid = $this->security->xss_clean($id);
|
||||||
|
|
||||||
|
$data['paper'] = $this->labels_model->getPaper($cleanid);
|
||||||
|
|
||||||
|
$data['page_title'] = "Edit Paper";
|
||||||
|
|
||||||
|
$this->load->view('interface_assets/header', $data);
|
||||||
|
$this->load->view('labels/editpaper');
|
||||||
|
$this->load->view('interface_assets/footer');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePaper($id) {
|
||||||
|
$this->load->model('labels_model');
|
||||||
|
try {
|
||||||
|
$this->labels_model->updatePaper($id);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
$this->session->set_flashdata('error', 'Your paper could not be saved. Remember that it can\'t have the same name as existing paper types.');
|
||||||
|
$cleanid = $this->security->xss_clean($id);
|
||||||
|
redirect('labels/editpaper/'.$cleanid);
|
||||||
|
}
|
||||||
|
$this->session->set_flashdata('message', 'Paper was saved.');
|
||||||
|
redirect('labels');
|
||||||
|
}
|
||||||
|
|
||||||
|
function label_cnt_with_paper($paper_id) {
|
||||||
|
$this->load->model('labels_model');
|
||||||
|
return $this->labels_model->label_cnt_with_paper($paper_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deletePaper($id) {
|
||||||
|
$this->load->model('labels_model');
|
||||||
|
$this->labels_model->deletePaper($id);
|
||||||
|
$this->session->set_flashdata('warning', 'Paper was deleted.');
|
||||||
|
redirect('labels');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class QSLPrint extends CI_Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index($station_id = 'All')
|
||||||
{
|
{
|
||||||
$this->load->model('user_model');
|
$this->load->model('user_model');
|
||||||
|
|
||||||
|
@ -28,10 +28,15 @@ class QSLPrint extends CI_Controller {
|
||||||
redirect('user/login');
|
redirect('user/login');
|
||||||
}
|
}
|
||||||
$this->load->model('stations');
|
$this->load->model('stations');
|
||||||
|
$data['station_id'] = $this->security->xss_clean($station_id);
|
||||||
$data['station_profile'] = $this->stations->all_of_user();
|
$data['station_profile'] = $this->stations->all_of_user();
|
||||||
|
|
||||||
$this->load->model('qslprint_model');
|
$this->load->model('qslprint_model');
|
||||||
$data['qsos'] = $this->qslprint_model->get_qsos_for_print();
|
if ( ($station_id != 'All') && ($this->stations->check_station_is_accessible($station_id)) ) {
|
||||||
|
$data['qsos'] = $this->qslprint_model->get_qsos_for_print($station_id);
|
||||||
|
} else {
|
||||||
|
$data['qsos'] = $this->qslprint_model->get_qsos_for_print();
|
||||||
|
}
|
||||||
|
|
||||||
$data['page_title'] = "Print Requested QSLs";
|
$data['page_title'] = "Print Requested QSLs";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class Migration_create_label_paper_types_table extends CI_Migration {
|
||||||
|
|
||||||
|
public function up() {
|
||||||
|
if (!$this->db->table_exists('paper_types')) {
|
||||||
|
$this->dbforge->add_field(array(
|
||||||
|
'paper_id' => array(
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 5,
|
||||||
|
'unsigned' => TRUE,
|
||||||
|
'auto_increment' => TRUE
|
||||||
|
),
|
||||||
|
|
||||||
|
'user_id' => array(
|
||||||
|
'type' => 'INT',
|
||||||
|
'constraint' => 5,
|
||||||
|
),
|
||||||
|
|
||||||
|
'paper_name' => array(
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => '250',
|
||||||
|
),
|
||||||
|
|
||||||
|
'metric' => array(
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => '10',
|
||||||
|
),
|
||||||
|
|
||||||
|
'width' => array(
|
||||||
|
'type' => 'DECIMAL',
|
||||||
|
'constraint' => '6,3',
|
||||||
|
'null' => TRUE,
|
||||||
|
),
|
||||||
|
|
||||||
|
'orientation' => array(
|
||||||
|
'type' => 'VARCHAR',
|
||||||
|
'constraint' => '1',
|
||||||
|
'null' => TRUE,
|
||||||
|
),
|
||||||
|
|
||||||
|
'height' => array(
|
||||||
|
'type' => 'DECIMAL',
|
||||||
|
'constraint' => '6,3',
|
||||||
|
'null' => TRUE,
|
||||||
|
),
|
||||||
|
|
||||||
|
'last_modified' => array(
|
||||||
|
'type' => 'timestamp',
|
||||||
|
'null' => TRUE,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->dbforge->add_key('paper_id', TRUE);
|
||||||
|
$this->dbforge->add_key('user_id', TRUE);
|
||||||
|
|
||||||
|
$this->dbforge->create_table('paper_types');
|
||||||
|
$this->db->query("ALTER TABLE label_types ADD COLUMN paper_type_id INT(5) NOT NULL;");
|
||||||
|
$this->db->query("CREATE UNIQUE INDEX idx_paper_types_user_id_paper_name ON paper_types (user_id, paper_name) ALGORITHM DEFAULT LOCK DEFAULT;");
|
||||||
|
$this->db->query("insert into paper_types (paper_id,user_id,paper_name,metric,width,orientation,height) values ('1','-1','A4','mm','210.000','P','297.000');");
|
||||||
|
$this->db->query("insert into paper_types (paper_id,user_id,paper_name,metric,width,orientation,height) values ('2','-1','A5','mm','148.000','P','210.000');");
|
||||||
|
$this->db->query("insert into paper_types (paper_id,user_id,paper_name,metric,width,orientation,height) values ('3','-1','letter','mm','215.900','P','279.400');");
|
||||||
|
$this->db->query("insert ignore paper_types (user_id,paper_name,metric,width,orientation,height) SELECT u.user_id, pt.paper_name, pt.metric, pt.width, pt.orientation,pt.height FROM paper_types pt inner join users u where pt.user_id = -1;");
|
||||||
|
$this->db->query("update label_types l set l.paper_type_id=(select p.paper_id from paper_types p where upper(p.paper_name)=upper(l.paper_type) and p.user_id=l.user_id limit 1) where l.paper_type_id=0;");
|
||||||
|
$this->db->query("update label_types l set l.paper_type_id = (select p.paper_id from paper_types p where p.user_id = l.user_id limit 1) where l.paper_type_id = 0;");
|
||||||
|
$this->db->query("alter table label_types drop column paper_type;");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(){
|
||||||
|
if ($this->db->table_exists('paper_types')) {
|
||||||
|
$this->dbforge->drop_table('paper_types');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->db->field_exists('paper_type_id', 'label_types')) {
|
||||||
|
$this->dbforge->drop_column('label_types', 'paper_type_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->db->field_exists('paper_type', 'label_types')) {
|
||||||
|
$fields = array(
|
||||||
|
'paper_type varchar(250)',
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->dbforge->add_column('label_types', $fields);
|
||||||
|
$this->db->query("update label_types set paper_type = 'a4';");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ class Labels_model extends CI_Model {
|
||||||
$data = array(
|
$data = array(
|
||||||
'user_id' => $this->session->userdata('user_id'),
|
'user_id' => $this->session->userdata('user_id'),
|
||||||
'label_name' => xss_clean($this->input->post('label_name', true)),
|
'label_name' => xss_clean($this->input->post('label_name', true)),
|
||||||
'paper_type' => xss_clean($this->input->post('paper_type', true)),
|
'paper_type_id' => xss_clean($this->input->post('paper_type_id', true)),
|
||||||
'metric' => xss_clean($this->input->post('measurementType', true)),
|
'metric' => xss_clean($this->input->post('measurementType', true)),
|
||||||
'marginleft' => xss_clean($this->input->post('marginLeft', true)),
|
'marginleft' => xss_clean($this->input->post('marginLeft', true)),
|
||||||
'margintop' => xss_clean($this->input->post('marginTop', true)),
|
'margintop' => xss_clean($this->input->post('marginTop', true)),
|
||||||
|
@ -25,19 +25,34 @@ class Labels_model extends CI_Model {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLabel($id) {
|
function addPaper() {
|
||||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
$data = array(
|
||||||
$this->db->where('id', $id);
|
'user_id' => $this->session->userdata('user_id'),
|
||||||
$query = $this->db->get('label_types');
|
'paper_name' => xss_clean($this->input->post('paper_name', true)),
|
||||||
|
'metric' => xss_clean($this->input->post('measurementType', true)),
|
||||||
return $query->row();
|
'width' => xss_clean($this->input->post('width', true)),
|
||||||
}
|
'height' => xss_clean($this->input->post('height', true)),
|
||||||
|
'orientation' => xss_clean($this->input->post('orientation', true)),
|
||||||
|
'last_modified' => date('Y-m-d H:i:s'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->db->insert('paper_types', $data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLabel($id,$user_id) {
|
||||||
|
$sql="SELECT l.id, l.user_id,l.label_name, p.paper_name, p.paper_id,l.paper_type_id,l.metric, l.marginleft, l.margintop, l.nx, l.ny, l.spacex, l.spacey, l.width, l.height, l.font_size, l.font, l.qsos, l.useforprint, l.last_modified FROM cloudlog.label_types l left outer join paper_types p on (p.user_id=l.user_id and p.paper_id=l.paper_type_id) where l.user_id=? and l.id=?;";
|
||||||
|
$query=$this->db->query($sql,array($user_id,$id));
|
||||||
|
$result=$query->result();
|
||||||
|
return $result[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateLabel($id) {
|
function updateLabel($id) {
|
||||||
$data = array(
|
$data = array(
|
||||||
'user_id' => $this->session->userdata('user_id'),
|
'user_id' => $this->session->userdata('user_id'),
|
||||||
'label_name' => xss_clean($this->input->post('label_name', true)),
|
'label_name' => xss_clean($this->input->post('label_name', true)),
|
||||||
'paper_type' => xss_clean($this->input->post('paper_type', true)),
|
'paper_type_id' => xss_clean($this->input->post('paper_type_id', true)),
|
||||||
'metric' => xss_clean($this->input->post('measurementType', true)),
|
'metric' => xss_clean($this->input->post('measurementType', true)),
|
||||||
'marginleft' => xss_clean($this->input->post('marginLeft', true)),
|
'marginleft' => xss_clean($this->input->post('marginLeft', true)),
|
||||||
'margintop' => xss_clean($this->input->post('marginTop', true)),
|
'margintop' => xss_clean($this->input->post('marginTop', true)),
|
||||||
|
@ -63,26 +78,31 @@ class Labels_model extends CI_Model {
|
||||||
function deleteLabel($id) {
|
function deleteLabel($id) {
|
||||||
$cleanid = xss_clean($id);
|
$cleanid = xss_clean($id);
|
||||||
|
|
||||||
$this->db->delete('label_types', array('id' => $cleanid, 'user_id' => $this->session->userdata('user_id')));
|
$this->db->delete('label_types', array('id' => $cleanid, 'user_id' => $this->session->userdata('user_id')));
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchLabels($user_id) {
|
function fetchLabels($user_id) {
|
||||||
$this->db->where('user_id', $user_id);
|
$sql="SELECT l.id, l.user_id,l.label_name, p.paper_name, l.metric, l.marginleft, l.margintop, l.nx, l.ny, l.spacex, l.spacey, l.width, l.height, l.font_size, l.font, l.qsos, l.useforprint, l.last_modified FROM cloudlog.label_types l left outer join paper_types p on (p.user_id=l.user_id and p.paper_id=l.paper_type_id) where l.user_id=?;";
|
||||||
$query = $this->db->get('label_types');
|
$query=$this->db->query($sql,$user_id);
|
||||||
|
|
||||||
return $query->result();
|
return $query->result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fetchPapertypes($user_id) {
|
||||||
|
$sql="SELECT p.paper_id,p.user_id,p.paper_name,p.metric,p.width,p.height,p.last_modified, p.orientation,COUNT(DISTINCT l.id) AS lbl_cnt FROM paper_types p LEFT OUTER JOIN label_types l ON (p.paper_id = l.paper_type_id and p.user_id=l.user_id) WHERE p.user_id = ? group by p.paper_id,p.user_id,p.paper_name,p.metric,p.width,p.height,p.last_modified;";
|
||||||
|
$query = $this->db->query($sql, $this->session->userdata('user_id'));
|
||||||
|
return $query->result();
|
||||||
|
}
|
||||||
|
|
||||||
function fetchQsos($user_id) {
|
function fetchQsos($user_id) {
|
||||||
|
|
||||||
$qsl = "select count(*) count, station_profile.station_profile_name, station_profile.station_callsign, station_profile.station_id, station_profile.station_gridsquare
|
$qsl = "select count(*) count, station_profile.station_profile_name, station_profile.station_callsign, station_profile.station_id, station_profile.station_gridsquare
|
||||||
from ". $this->config->item('table_name') . " as l
|
from ". $this->config->item('table_name') . " as l
|
||||||
join station_profile on l.station_id = station_profile.station_id
|
join station_profile on l.station_id = station_profile.station_id
|
||||||
where l.COL_QSL_SENT in ('R', 'Q')
|
where l.COL_QSL_SENT in ('R', 'Q')
|
||||||
and station_profile.user_id = " . $user_id .
|
and station_profile.user_id = " . $user_id .
|
||||||
" group by station_profile.station_profile_name, station_profile.station_callsign, station_profile.station_id, station_profile.station_gridsquare
|
" group by station_profile.station_profile_name, station_profile.station_callsign, station_profile.station_id, station_profile.station_gridsquare
|
||||||
order by station_profile.station_callsign";
|
order by station_profile.station_callsign";
|
||||||
|
|
||||||
$query = $this->db->query($qsl);
|
$query = $this->db->query($qsl);
|
||||||
|
|
||||||
return $query->result();
|
return $query->result();
|
||||||
|
@ -92,7 +112,15 @@ class Labels_model extends CI_Model {
|
||||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||||
$this->db->where('useforprint', '1');
|
$this->db->where('useforprint', '1');
|
||||||
$query = $this->db->get('label_types');
|
$query = $this->db->get('label_types');
|
||||||
|
|
||||||
|
return $query->row();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPaperType($ptype_id) {
|
||||||
|
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||||
|
$this->db->where('paper_id',$ptype_id);
|
||||||
|
$query = $this->db->get('paper_types');
|
||||||
|
|
||||||
return $query->row();
|
return $query->row();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,4 +173,48 @@ class Labels_model extends CI_Model {
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updatePaper($id) {
|
||||||
|
$data = array(
|
||||||
|
'user_id' => $this->session->userdata('user_id'),
|
||||||
|
'paper_name' => xss_clean($this->input->post('paper_name', true)),
|
||||||
|
'metric' => xss_clean($this->input->post('measurementType', true)),
|
||||||
|
'width' => xss_clean($this->input->post('width', true)),
|
||||||
|
'height' => xss_clean($this->input->post('height', true)),
|
||||||
|
'orientation' => xss_clean($this->input->post('orientation', true)),
|
||||||
|
'last_modified' => date('Y-m-d H:i:s'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$cleanid = $this->security->xss_clean($id);
|
||||||
|
|
||||||
|
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||||
|
$this->db->where('paper_id', $cleanid);
|
||||||
|
$this->db->update('paper_types', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function label_cnt_with_paper($paper_id) {
|
||||||
|
$clean_paper_id=xss_clean($paper_id);
|
||||||
|
$sql="select count(distinct l.id) as CNT from label_types l inner join paper_types p on (p.paper_id=l.paper_type_id) where l.user_id=? and p.user_id=? and l.paper_type_id=?";
|
||||||
|
$query = $this->db->query($sql, array($this->session->userdata('user_id'), this->session->userdata('user_id'), $clean_paper_id));
|
||||||
|
$row = $query->row();
|
||||||
|
if (isset($row)) {
|
||||||
|
return($row->CNT);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletePaper($id) {
|
||||||
|
$cleanid = xss_clean($id);
|
||||||
|
|
||||||
|
$this->db->delete('paper_types', array('paper_id' => $cleanid, 'user_id' => $this->session->userdata('user_id')));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPaper($id) {
|
||||||
|
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||||
|
$this->db->where('paper_id', $id);
|
||||||
|
$query = $this->db->get('paper_types');
|
||||||
|
|
||||||
|
return $query->row();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,7 @@ class User_Model extends CI_Model {
|
||||||
$this->db->insert($this->config->item('auth_table'), $data);
|
$this->db->insert($this->config->item('auth_table'), $data);
|
||||||
$insert_id = $this->db->insert_id();
|
$insert_id = $this->db->insert_id();
|
||||||
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;");
|
$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;");
|
||||||
|
$this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where user_id = -1;");
|
||||||
return OK;
|
return OK;
|
||||||
} else {
|
} else {
|
||||||
return EUSERNAMEEXISTS;
|
return EUSERNAMEEXISTS;
|
||||||
|
|
|
@ -25,11 +25,14 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-2 col-form-label" for="paperType">Paper Type</label>
|
<label class="col-sm-2 col-form-label" for="paperType_id">Paper Type</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<select name="paper_type" class="form-control" id="paperType">
|
<select name="paper_type_id" class="form-control" id="paperType_id">
|
||||||
<option value="a4">A4</option>
|
<?php
|
||||||
<option value="letter">Letter</option>
|
foreach($papertypes as $paper){
|
||||||
|
echo '<option value=' . $paper->paper_id . '>' . ucwords(strtolower(($paper->paper_name))) . '</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
<div id="qsl_card_labels_container" class="container">
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<?php if($this->session->flashdata('message')) { ?>
|
||||||
|
<!-- Display Message -->
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
<?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>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php echo validation_errors(); ?>
|
||||||
|
|
||||||
|
<form method="post" action="<?php echo site_url('labels/createpaper'); ?>" name="create_paper_type">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h2 class="card-header"><?php echo $page_title; ?></h2>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<!-- Label Name Input -->
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class= "col-sm-2 col-form-label" for="PaperName">Paper Type Name</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="paper_name" type="text" class="form-control" id="PaperName" aria-describedby="paper_nameHelp">
|
||||||
|
<small id="paper_nameHelp" class="form-text text-muted">Paper name used for display purposes, so pick something meaningful.</small>
|
||||||
|
</div>
|
||||||
|
<label class="col-sm-2 col-form-label" for="measurementType">Measurement used</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select name="measurementType" class="form-control" id="measurementType">
|
||||||
|
<option selected value="mm">Millimeters</option>
|
||||||
|
<!-- <option value="in">Inches</option> -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-2 col-form-label" for="width">Width of paper</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="width" type="text" class="form-control" id="width" aria-describedby="widthHelp">
|
||||||
|
<small id="widthHelp" class="form-text text-muted">Total width of paper.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label class="col-sm-2 col-form-label" for="height">Height of paper</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="height" type="text" class="form-control" id="height" aria-describedby="heightHelp">
|
||||||
|
<small id="heightHelp" class="form-text text-muted">Total height of paper</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-2 col-form-label" for="orientation">Orientation of paper</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select name="orientation" class="form-control" id="orientation">
|
||||||
|
<option value="L">Landscape</option>
|
||||||
|
<option value="P">Portrait</option>
|
||||||
|
</select>
|
||||||
|
<small id="heightHelp" class="form-text text-muted">Orientation of paper</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Save Paper Type</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
|
@ -25,11 +25,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-2 col-form-label" for="paperType">Paper Type</label>
|
<label class="col-sm-2 col-form-label" for="paperType_id">Paper Type</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<select name="paper_type" class="form-control" id="paperType">
|
<select name="paper_type_id" class="form-control" id="paperType_id">
|
||||||
<option value="a4" <?php if($label->paper_type == "a4") { echo "selected=\"selected\""; } ?>>A4</option>
|
<?php
|
||||||
<option value="letter" <?php if($label->paper_type == "letter") { echo "selected=\"selected\""; } ?>>Letter</option>
|
foreach($papertypes as $paper){
|
||||||
|
echo '<option value="' . ($paper->paper_id ?? '') . '"';
|
||||||
|
if (($label->paper_type_id ?? '') == ($paper->paper_id ?? '')) echo ' selected';
|
||||||
|
echo '>' . ucwords(strtolower(($paper->paper_name ?? ''))) . '</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
<div id="qsl_card_labels_container" class="container">
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<?php if($this->session->flashdata('message')) { ?>
|
||||||
|
<!-- Display Message -->
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
<?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>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php echo validation_errors(); ?>
|
||||||
|
|
||||||
|
<form method="post" action="<?php echo site_url('labels/updatePaper/' . $paper->paper_id); ?>" name="create_label_type">
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h2 class="card-header"><?php echo $page_title; ?></h2>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
|
<!-- Label Name Input -->
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class= "col-sm-2 col-form-label" for="PaperName">Paper Type Name</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="paper_name" type="text" class="form-control" id="PaperName" aria-describedby="paper_nameHelp" value="<?php if(isset($paper->paper_name)) { echo $paper->paper_name; } ?>">
|
||||||
|
<small id="paper_nameHelp" class="form-text text-muted">Paper name used for display purposes, so pick something meaningful.</small>
|
||||||
|
</div>
|
||||||
|
<label class="col-sm-2 col-form-label" for="measurementType">Measurement used</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select name="measurementType" class="form-control" id="measurementType">
|
||||||
|
<option value="mm" <?php if($paper->metric == "mm") { echo "selected=\"selected\""; } ?>>Millimeters</option>
|
||||||
|
<!-- <option value="in" <?php if($paper->metric == "in") { echo "selected=\"selected\""; } ?>>Inches</option> -->
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-2 col-form-label" for="width">Width of paper</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="width" type="text" class="form-control" id="width" aria-describedby="widthHelp" value="<?php if(isset($paper->width)) { echo $paper->width; } ?>">
|
||||||
|
<small id="widthHelp" class="form-text text-muted">Total width of paper.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label class="col-sm-2 col-form-label" for="height">Height of paper</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input name="height" type="text" class="form-control" id="height" aria-describedby="heightHelp" value="<?php if(isset($paper->height)) { echo $paper->height; } ?>">
|
||||||
|
<small id="heightHelp" class="form-text text-muted">Total width of paper.</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-2 col-form-label" for="orientation">Orientation of paper</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select name="orientation" class="form-control" id="orientation">
|
||||||
|
<option value="L"<?php if($paper->orientation == 'L') { echo " selected"; } ?>>Landscape</option>
|
||||||
|
<option value="P"<?php if($paper->orientation == 'P') { echo " selected"; } ?>>Portrait</option>
|
||||||
|
</select>
|
||||||
|
<small id="heightHelp" class="form-text text-muted">Orientation of paper</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary"><i class="fas fa-plus-square"></i> Save Paper Type</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br>
|
|
@ -26,11 +26,45 @@
|
||||||
<h2 class="card-header">QSL Card Labels</h2>
|
<h2 class="card-header">QSL Card Labels</h2>
|
||||||
|
|
||||||
<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>
|
||||||
|
<a href="<?php echo site_url('labels/createpaper'); ?>" class="btn btn-outline-primary btn-sm">Create New Paper Type</a>
|
||||||
|
<br><br>
|
||||||
|
<?php if ($papertypes) { ?>
|
||||||
|
<h4>Paper types</h4>
|
||||||
|
<table style="width:100%" class="table-sm labeltable table-bordered table-hover table-striped table-condensed text-center">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Measurement</th>
|
||||||
|
<th>Width</th>
|
||||||
|
<th>Height</th>
|
||||||
|
<th>Used by labels</th>
|
||||||
|
<th>Orientation</th>
|
||||||
|
<th>Edit</th>
|
||||||
|
<th>Delete</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach($papertypes as $paper) { ?>
|
||||||
|
<tr class='paper_<?php echo $paper->paper_id ?>'>
|
||||||
|
<td><?php echo $paper->paper_name; ?></td>
|
||||||
|
<td><?php echo $paper->metric; ?></td>
|
||||||
|
<td><?php echo $paper->width; ?></td>
|
||||||
|
<td><?php echo $paper->height; ?></td>
|
||||||
|
<td><?php echo $paper->lbl_cnt ?? '0' ?></td>
|
||||||
|
<td><?php echo $paper->orientation == 'P' ? 'Portrait': 'Landscape'; ?></td>
|
||||||
|
<td><a href="<?php echo site_url('labels/editpaper/' . $paper->paper_id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td>
|
||||||
|
<td><a href="javascript:deletepaper(<?php echo $paper->paper_id; ?>);" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php }
|
||||||
|
echo '</tbody></table>';
|
||||||
|
} ?>
|
||||||
|
|
||||||
<?php if ($labels) {
|
<?php if ($labels) { ?>
|
||||||
echo '<br/><br/>';?>
|
<br>
|
||||||
|
<h4>Label types</h4>
|
||||||
<table style="width:100%" class="table-sm labeltable table-bordered table-hover table-striped table-condensed text-center">
|
<table style="width:100%" class="table-sm labeltable table-bordered table-hover table-striped table-condensed text-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -41,7 +75,6 @@
|
||||||
<th>Height</th>
|
<th>Height</th>
|
||||||
<th>Font Size</th>
|
<th>Font Size</th>
|
||||||
<th>QSOs</th>
|
<th>QSOs</th>
|
||||||
<th>Last Modified</th>
|
|
||||||
<th>Use For Print</th>
|
<th>Use For Print</th>
|
||||||
<th>Edit</th>
|
<th>Edit</th>
|
||||||
<th>Delete</th>
|
<th>Delete</th>
|
||||||
|
@ -52,16 +85,19 @@
|
||||||
foreach($labels as $label) { ?>
|
foreach($labels as $label) { ?>
|
||||||
<tr class='label_<?php echo $label->id ?>'>
|
<tr class='label_<?php echo $label->id ?>'>
|
||||||
<td><?php echo $label->label_name; ?></td>
|
<td><?php echo $label->label_name; ?></td>
|
||||||
<td><?php echo $label->paper_type; ?></td>
|
<td><?php echo $label->paper_name ?? '<span class="badge badge-danger">No paper assigned</span>' ?></td>
|
||||||
<td><?php echo $label->metric; ?></td>
|
<td><?php echo $label->metric; ?></td>
|
||||||
<td><?php echo $label->width; ?></td>
|
<td><?php echo $label->width; ?></td>
|
||||||
<td><?php echo $label->height; ?></td>
|
<td><?php echo $label->height; ?></td>
|
||||||
<td><?php echo $label->font_size; ?></td>
|
<td><?php echo $label->font_size; ?></td>
|
||||||
<td><?php echo $label->qsos; ?></td>
|
<td><?php echo $label->qsos; ?></td>
|
||||||
<td><?php echo $label->last_modified; ?></td>
|
<?php if (($label->paper_name ?? '') == '') { ?>
|
||||||
|
<td></td>
|
||||||
|
<?php } else { ?>
|
||||||
<td><input type="checkbox" <?php if ($label->useforprint == 1) {echo 'checked';}?>></td>
|
<td><input type="checkbox" <?php if ($label->useforprint == 1) {echo 'checked';}?>></td>
|
||||||
|
<?php } ?>
|
||||||
<td><a href="<?php echo site_url('labels/edit/' . $label->id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td>
|
<td><a href="<?php echo site_url('labels/edit/' . $label->id); ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a></td>
|
||||||
<td><a href="<?php echo site_url('labels/delete/' . $label->id); ?>" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td>
|
<td><a href="javascript:deletelabel(<?php echo $label->id; ?>);" class="btn btn-outline-danger btn-sm"><i class="fas fa-trash-alt"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php }
|
<?php }
|
||||||
|
@ -95,7 +131,7 @@
|
||||||
echo '<td>' . $qso->station_profile_name . '</td>';
|
echo '<td>' . $qso->station_profile_name . '</td>';
|
||||||
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') . '/index/'.$qso->station_id.'" class="btn btn-outline-info btn-sm"><i class="fas fa-search"></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 '<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>';
|
||||||
} ?>
|
} ?>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<select name="station_profile" class="station_id custom-select mb-3 mr-sm-3" style="width: 20%;">
|
<select name="station_profile" class="station_id custom-select mb-3 mr-sm-3" style="width: 20%;">
|
||||||
<option value="All">All</option>
|
<option value="All">All</option>
|
||||||
<?php foreach ($station_profile->result() as $station) { ?>
|
<?php foreach ($station_profile->result() as $station) { ?>
|
||||||
<option value="<?php echo $station->station_id; ?>">Callsign: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
|
<option <?php if ($station->station_id == $station_id) { echo "selected "; } ?>value="<?php echo $station->station_id; ?>">Callsign: <?php echo $station->station_callsign; ?> (<?php echo $station->station_profile_name; ?>)</option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
|
@ -37,4 +37,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -39,3 +39,41 @@ function printat(stationid) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deletelabel(id) {
|
||||||
|
BootstrapDialog.confirm({
|
||||||
|
title: 'DANGER',
|
||||||
|
message: 'Warning! Are you sure you want this label?',
|
||||||
|
type: BootstrapDialog.TYPE_DANGER,
|
||||||
|
closable: true,
|
||||||
|
draggable: true,
|
||||||
|
btnOKClass: 'btn-danger',
|
||||||
|
callback: function(result) {
|
||||||
|
if (result) {
|
||||||
|
window.location.replace(base_url + 'index.php/labels/delete/'+id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletepaper(id) {
|
||||||
|
var message = 'Warning! Are you sure you want delete this paper type?';
|
||||||
|
var currentRow = $(".paper_"+id).first().closest('tr');
|
||||||
|
var inuse = currentRow.find("td:eq(4)").text();
|
||||||
|
if (inuse > 0) {
|
||||||
|
message = 'Warning! This paper type is in use. Are you really sure you want delete this paper type?';
|
||||||
|
}
|
||||||
|
BootstrapDialog.confirm({
|
||||||
|
title: 'DANGER',
|
||||||
|
message: message,
|
||||||
|
type: BootstrapDialog.TYPE_DANGER,
|
||||||
|
closable: true,
|
||||||
|
draggable: true,
|
||||||
|
btnOKClass: 'btn-danger',
|
||||||
|
callback: function(result) {
|
||||||
|
if (result) {
|
||||||
|
window.location.replace(base_url + 'index.php/labels/deletePaper/'+id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -69,25 +69,26 @@ class PDF_Label extends tfpdf {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
function __construct($format, $unit='mm', $posX=1, $posY=1) {
|
function __construct($format, $unit='mm', $posX=1, $posY=1, $pgX=0,$pgY=0) {
|
||||||
if (is_array($format)) {
|
if (is_array($format)) {
|
||||||
// Custom format
|
// Custom format
|
||||||
$Tformat = $format;
|
// var_dump("X".$pgX);
|
||||||
} else {
|
$Tformat = $format;
|
||||||
// Built-in format
|
} else {
|
||||||
if (!isset($this->_Avery_Labels[$format]))
|
// Built-in format
|
||||||
$this->Error('Unknown label format: '.$format);
|
if (!isset($this->_Avery_Labels[$format]))
|
||||||
$Tformat = $this->_Avery_Labels[$format];
|
$this->Error('Unknown label format: '.$format);
|
||||||
}
|
$Tformat = $this->_Avery_Labels[$format];
|
||||||
|
}
|
||||||
|
|
||||||
parent::__construct('P', $unit, $Tformat['paper-size']);
|
parent::__construct('P', $unit, $Tformat['paper-size'],$Tformat['pgX'],$Tformat['pgY']);
|
||||||
$this->_Metric_Doc = $unit;
|
$this->_Metric_Doc = $unit;
|
||||||
$this->_Set_Format($Tformat);
|
$this->_Set_Format($Tformat);
|
||||||
$this->SetFont('Arial');
|
$this->SetFont('Arial');
|
||||||
$this->SetMargins(0,0);
|
$this->SetMargins(0,0);
|
||||||
$this->SetAutoPageBreak(false);
|
$this->SetAutoPageBreak(false);
|
||||||
$this->_COUNTX = $posX-2;
|
$this->_COUNTX = $posX-2;
|
||||||
$this->_COUNTY = $posY-1;
|
$this->_COUNTY = $posY-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _Set_Format($format) {
|
function _Set_Format($format) {
|
||||||
|
@ -132,7 +133,7 @@ class PDF_Label extends tfpdf {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print a label
|
// Print a label
|
||||||
function Add_Label($text) {
|
function Add_Label($text,$orientation = 'P') {
|
||||||
$this->_COUNTX++;
|
$this->_COUNTX++;
|
||||||
if ($this->_COUNTX == $this->_X_Number) {
|
if ($this->_COUNTX == $this->_X_Number) {
|
||||||
// Row full, we start a new one
|
// Row full, we start a new one
|
||||||
|
@ -141,7 +142,7 @@ class PDF_Label extends tfpdf {
|
||||||
if ($this->_COUNTY == $this->_Y_Number) {
|
if ($this->_COUNTY == $this->_Y_Number) {
|
||||||
// End of page reached, we start a new one
|
// End of page reached, we start a new one
|
||||||
$this->_COUNTY=0;
|
$this->_COUNTY=0;
|
||||||
$this->AddPage();
|
$this->AddPage($orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ protected $PDFVersion; // PDF version number
|
||||||
* Public methods *
|
* Public methods *
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
function __construct($orientation='P', $unit='mm', $size='A4')
|
function __construct($orientation='P', $unit='mm', $size='A4',$pgX = 0,$pgY =0)
|
||||||
{
|
{
|
||||||
// Some checks
|
// Some checks
|
||||||
$this->_dochecks();
|
$this->_dochecks();
|
||||||
|
@ -131,6 +131,9 @@ function __construct($orientation='P', $unit='mm', $size='A4')
|
||||||
// Page sizes
|
// Page sizes
|
||||||
$this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
|
$this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
|
||||||
'letter'=>array(612,792), 'legal'=>array(612,1008));
|
'letter'=>array(612,792), 'legal'=>array(612,1008));
|
||||||
|
if ($size == 'custom') {
|
||||||
|
$size=array($pgX,$pgY);
|
||||||
|
}
|
||||||
$size = $this->_getpagesize($size);
|
$size = $this->_getpagesize($size);
|
||||||
$this->DefPageSize = $size;
|
$this->DefPageSize = $size;
|
||||||
$this->CurPageSize = $size;
|
$this->CurPageSize = $size;
|
||||||
|
|
Ładowanie…
Reference in New Issue