mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:37:02 +02:00
added retention policy web part
This commit is contained in:
76
webui/controller/policy/removeretention.php
Normal file
76
webui/controller/policy/removeretention.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerPolicyRemoveretention extends Controller {
|
||||
private $error = array();
|
||||
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "policy/removeretention.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('policy/retention');
|
||||
|
||||
$this->document->title = $this->data['text_retention_rules'];
|
||||
|
||||
|
||||
$this->data['username'] = Registry::get('username');
|
||||
|
||||
$this->data['id'] = @$this->request->get['id'];
|
||||
$this->data['confirmed'] = (int)@$this->request->get['confirmed'];
|
||||
|
||||
|
||||
$this->data['rule'] = $this->model_policy_retention->get_rule($this->data['id']);
|
||||
|
||||
if($this->validate() == true) {
|
||||
|
||||
if($this->data['confirmed'] == 1) {
|
||||
$ret = $this->model_policy_retention->remove_rule($this->data['id']);
|
||||
if($ret == 1){
|
||||
$this->data['x'] = $this->data['text_successfully_removed'];
|
||||
}
|
||||
else {
|
||||
$this->data['x'] = $this->data['text_failed_to_remove'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->template = "common/error.tpl";
|
||||
$this->data['errorstring'] = array_pop($this->error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
private function validate() {
|
||||
|
||||
if(Registry::get('admin_user') == 0) {
|
||||
$this->error['admin'] = $this->data['text_you_are_not_admin'];
|
||||
}
|
||||
|
||||
if(!isset($this->request->get['id']) || $this->request->get['id'] < 1 ) {
|
||||
$this->error['rule'] = $this->data['text_invalid_data'];
|
||||
}
|
||||
|
||||
|
||||
if (!$this->error) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
41
webui/controller/policy/retention.php
Normal file
41
webui/controller/policy/retention.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
|
||||
class ControllerPolicyRetention extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index(){
|
||||
|
||||
$this->id = "content";
|
||||
$this->template = "policy/retention.tpl";
|
||||
$this->layout = "common/layout";
|
||||
|
||||
|
||||
$request = Registry::get('request');
|
||||
|
||||
$db = Registry::get('db');
|
||||
|
||||
$this->load->model('policy/retention');
|
||||
|
||||
$this->document->title = $this->data['text_retention_rules'];
|
||||
|
||||
$this->data['rules'] = array();
|
||||
|
||||
if(Registry::get('admin_user') == 0) {
|
||||
die("go away");
|
||||
}
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$rc = $this->model_policy_retention->add_new_rule($this->request->post);
|
||||
}
|
||||
|
||||
$this->data['rules'] = $this->model_policy_retention->get_rules();
|
||||
|
||||
|
||||
$this->render();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user