mourne_rcpp_fw/Mourne-CI/application/controllers/changelog.php

72 lines
1.7 KiB
PHP
Raw Normal View History

2021-10-30 19:02:07 +02:00
<?php
class Changelog extends MO_Controller
{
public function __construct()
{
parent::__construct();
}
2021-10-30 19:02:07 +02:00
public function show()
{
$this->load->model('changelog_model');
2021-10-30 19:02:07 +02:00
$data['versions'] = $this->changelog_model->get_versions();
$data['commits'] = $this->changelog_model->get_commits();
$data['userlevel'] = $this->userlevel;
$data['required_userlevel'] = 4;
2021-10-30 19:02:07 +02:00
$this->headers();
$this->load->view('changelog/changelog', $data);
$this->footer();
}
2021-10-30 19:02:07 +02:00
public function add_new_version()
{
if (!$this->userlevel > 4) {
show404();
}
2021-10-30 19:02:07 +02:00
$this->load->library('form_validation');
2021-10-30 19:02:07 +02:00
$this->form_validation->set_rules('text', 'Text', 'required');
2021-10-30 19:02:07 +02:00
if (!$this->form_validation->run()) {
$this->load->view('changelog/new_version');
} else {
$this->load->model('changelog_model');
2021-10-30 19:02:07 +02:00
$text = $this->input->post('text');
$this->changelog_model->new_version($text);
2021-10-30 19:02:07 +02:00
$this->load->helper('url');
redirect('changelog/show');
}
2021-10-30 19:02:07 +02:00
}
public function add_new_commit()
{
if (!$this->userlevel > 4) {
show404();
}
2021-10-30 19:02:07 +02:00
$this->load->library('form_validation');
2021-10-30 19:02:07 +02:00
$this->form_validation->set_rules('text', 'Text', 'required');
2021-10-30 19:02:07 +02:00
if (!$this->form_validation->run()) {
$this->load->view('changelog/new_commit');
} else {
$this->load->model('changelog_model');
2021-10-30 19:02:07 +02:00
$text = $this->input->post('text');
$this->changelog_model->new_commit($text);
2021-10-30 19:02:07 +02:00
$this->load->helper('url');
redirect('changelog/show');
}
2021-10-30 19:02:07 +02:00
}
}
//nowhitesp