1<?php 2 3$labels = $this->model->labelFactory->get_all(); 4 5if ($this->get_param('id') === '') { 6 $label = $this->model->labelFactory->create_object(); 7} else { 8 $label = $this->model->labelFactory->get_one($this->get_param('id')); 9} 10 11$this->tpl->set('labels', $labels); 12$this->tpl->set('label', $label); 13 14 15if ($this->get_param('action') === 'edit') { 16 17 $this->tpl->set_values($label->get_assoc()); 18 19} else if ($this->get_param('action') === 'remove') { 20 21 $this->model->labelFactory->delete($label); 22 23 header('Location: '.$this->url('types')); 24 25} elseif (count($_POST) > 0) { 26 $label->set_data($_POST); 27 $this->model->labelFactory->save($label); 28 29 header('Location: '.$this->url('types')); 30} 31