1<?php 2/** @var action_plugin_bez $this */ 3 4use \dokuwiki\plugin\bez; 5 6if ($this->model->get_level() < BEZ_AUTH_ADMIN) { 7 throw new bez\meta\PermissionDeniedException(); 8} 9 10$labels = $this->model->labelFactory->get_all(); 11 12if ($this->get_param('id') === '') { 13 $label = $this->model->labelFactory->create_object(); 14} else { 15 $label = $this->model->labelFactory->get_one($this->get_param('id')); 16} 17 18$this->tpl->set('labels', $labels); 19$this->tpl->set('label', $label); 20 21 22if ($this->get_param('action') === 'edit') { 23 24 $this->tpl->set_values($label->get_assoc()); 25 26} else if ($this->get_param('action') === 'remove') { 27 28 $this->model->labelFactory->delete($label); 29 30 header('Location: '.$this->url('types')); 31 32} elseif (count($_POST) > 0) { 33 $label->set_data($_POST); 34 $this->model->labelFactory->save($label); 35 36 header('Location: '.$this->url('types')); 37} 38