52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class Redirects extends MY_Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('RedirectModel', '', TRUE);
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->neededPermission('redirect.view');
|
|
|
|
$redirects = $this->RedirectModel->getItems();
|
|
$this->load->view('admin/sidebar', ['title' => 'Alle Weiterleitungen']);
|
|
$this->load->view('admin/redirects', ['redirects' => $redirects]);
|
|
$this->load->view('admin/footer', ['additionalScripts' => ['redirects.js']]);
|
|
}
|
|
|
|
public function addRedirect() {
|
|
$this->neededPermission('redirect.create');
|
|
|
|
$id = $this->input->post('redirectID');
|
|
$name = $this->input->post('redirectName');
|
|
$url = $this->input->post('redirectUrl');
|
|
|
|
if(isset($name) && isset($url)) {
|
|
if(isset($id)) {
|
|
$this->neededPermission('redirect.edit');
|
|
|
|
$this->RedirectModel->editRedirect($id, $url, $name);
|
|
} else {
|
|
$this->RedirectModel->insertRedirect($url, $name);
|
|
}
|
|
}
|
|
|
|
redirect(base_url('admin/redirects'));
|
|
}
|
|
|
|
public function removeRedirect($id = null) {
|
|
$this->neededPermission('redirect.delete');
|
|
|
|
if($id != null) {
|
|
$this->RedirectModel->removeRedirect($id);
|
|
}
|
|
|
|
redirect(base_url('admin/redirects'));
|
|
}
|
|
} |