kopia lustrzana https://github.com/magicbug/Cloudlog
Added warning if no paper_type is assigned
rodzic
dc7018def0
commit
85a2299322
|
@ -331,7 +331,7 @@ class Labels extends CI_Controller {
|
|||
|
||||
$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'));
|
||||
|
||||
|
|
|
@ -40,14 +40,13 @@ class Labels_model extends CI_Model {
|
|||
|
||||
}
|
||||
|
||||
function getLabel($id) {
|
||||
$this->db->join('paper_types', 'paper_types.paper_id = label_types.paper_type_id');
|
||||
$this->db->where('label_types.user_id', $this->session->userdata('user_id'));
|
||||
$this->db->where('label_types.id', $id);
|
||||
$query = $this->db->get('label_types');
|
||||
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];
|
||||
}
|
||||
|
||||
return $query->row();
|
||||
}
|
||||
|
||||
function updateLabel($id) {
|
||||
$data = array(
|
||||
|
@ -83,10 +82,8 @@ class Labels_model extends CI_Model {
|
|||
}
|
||||
|
||||
function fetchLabels($user_id) {
|
||||
$this->db->join('paper_types', 'paper_types.paper_id = label_types.paper_type_id');
|
||||
$this->db->where('label_types.user_id', $user_id);
|
||||
$query = $this->db->get('label_types');
|
||||
|
||||
$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->query($sql,$user_id);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
<select name="paper_type_id" class="form-control" id="paperType_id">
|
||||
<?php
|
||||
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>';
|
||||
echo '<option value="' . ($paper->paper_id ?? '') . '"';
|
||||
if (($label->paper_type_id ?? '') == ($paper->paper_id ?? '')) echo ' selected';
|
||||
echo '>' . ucwords(strtolower(($paper->paper_name ?? ''))) . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
foreach($labels as $label) { ?>
|
||||
<tr class='label_<?php echo $label->id ?>'>
|
||||
<td><?php echo $label->label_name; ?></td>
|
||||
<td><?php echo $label->paper_name; ?></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->width; ?></td>
|
||||
<td><?php echo $label->height; ?></td>
|
||||
|
|
Ładowanie…
Reference in New Issue