diff --git a/application/config/migration.php b/application/config/migration.php index 688dfffe..6a1ed952 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE; | */ -$config['migration_version'] = 132; +$config['migration_version'] = 133; /* |-------------------------------------------------------------------------- diff --git a/application/migrations/133_create_label_paper_types_table.php b/application/migrations/133_create_label_paper_types_table.php new file mode 100644 index 00000000..34e87528 --- /dev/null +++ b/application/migrations/133_create_label_paper_types_table.php @@ -0,0 +1,63 @@ +db->table_exists('paper_types')) { + $this->dbforge->add_field(array( + '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, + ), + + 'height' => array( + 'type' => 'DECIMAL', + 'constraint' => '6,3', + 'null' => TRUE, + ), + + 'last_modified' => array( + 'type' => 'timestamp', + 'null' => TRUE, + ), + )); + + $this->dbforge->add_key('id', TRUE); + $this->dbforge->add_key('user_id', TRUE); + + $this->dbforge->create_table('paper_types'); + } + + } + + public function down(){ + if ($this->db->table_exists('paper_types')) { + $this->dbforge->drop_table('paper_types'); + } + } +} diff --git a/application/models/Labels_model.php b/application/models/Labels_model.php index 41db763a..9f528f47 100644 --- a/application/models/Labels_model.php +++ b/application/models/Labels_model.php @@ -25,11 +25,25 @@ class Labels_model extends CI_Model { } + function addPaper() { + $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)), + 'last_modified' => date('Y-m-d H:i:s'), + ); + + $this->db->insert('paper_types', $data); + + } + function getLabel($id) { $this->db->where('user_id', $this->session->userdata('user_id')); $this->db->where('id', $id); $query = $this->db->get('label_types'); - + return $query->row(); } @@ -63,26 +77,26 @@ class Labels_model extends CI_Model { function deleteLabel($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) { $this->db->where('user_id', $user_id); $query = $this->db->get('label_types'); - + return $query->result(); } 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 - 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 where l.COL_QSL_SENT in ('R', 'Q') 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 order by station_profile.station_callsign"; - + $query = $this->db->query($qsl); return $query->result(); @@ -92,7 +106,7 @@ class Labels_model extends CI_Model { $this->db->where('user_id', $this->session->userdata('user_id')); $this->db->where('useforprint', '1'); $query = $this->db->get('label_types'); - + return $query->row(); } diff --git a/application/views/labels/createpaper.php b/application/views/labels/createpaper.php new file mode 100644 index 00000000..d9eaf683 --- /dev/null +++ b/application/views/labels/createpaper.php @@ -0,0 +1,57 @@ +
+ +
+ session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ + + + +
+ +
+

+ +
+ + +
+ +
+ + Paper name used for display purposes, so pick something meaningful. +
+ +
+ +
+
+ +
+ +
+ + Total width of paper. +
+ + +
+ + Total height of paper +
+
+ + +
+
+ +
+ +
+
diff --git a/application/views/labels/editpaper.php b/application/views/labels/editpaper.php new file mode 100644 index 00000000..695fded7 --- /dev/null +++ b/application/views/labels/editpaper.php @@ -0,0 +1,120 @@ +
+ +
+ session->flashdata('message')) { ?> + +
+

session->flashdata('message'); ?>

+
+ + + + +
+ +
+

+ +
+ + +
+ + + Label name used for display purposes so pick something meaningful perhaps the label style. +
+ +
+ +
+ +
+ + +
+ +
+
+ +
+ +
+ + Top margin of labels +
+ + +
+ + Left margin of labels. +
+
+ +
+ +
+ + Number of labels horizontally across the page. +
+ + +
+ + Number of labels vertically across the page. +
+
+ +
+ +
+ + Horizontal space between 2 labels. +
+ + +
+ + Vertical space between 2 labels. +
+
+ +
+ +
+ + Total width of one label. +
+ + +
+ + Total height of one label +
+
+ +
+ +
+ + Font size used on the label don't go too big. +
+ + +
+ +
+
+ +
+
+ +
+ +
+
diff --git a/application/views/labels/index.php b/application/views/labels/index.php index 6e655133..db63184a 100644 --- a/application/views/labels/index.php +++ b/application/views/labels/index.php @@ -26,7 +26,8 @@

QSL Card Labels

- Create New Label Type + Create New Label Type + Create New Paper Type