aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers/HistoryController.php
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Controllers/HistoryController.php')
-rw-r--r--h-source/Application/Controllers/HistoryController.php57
1 files changed, 48 insertions, 9 deletions
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index 3b6e1d2..a3421a9 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -32,7 +32,8 @@ class HistoryController extends BaseController
'page' => 'wiki page',
'page_del' => 'wiki page',
'device' => 'device page',
- 'device_app' => 'device page',
+ 'device_app' => 'device page',
+ 'device_cl' => 'device page',
);
public static $actionTable = array(
@@ -49,6 +50,7 @@ class HistoryController extends BaseController
'devicehide' => 'hide',
'deviceshow' => 'show',
'deviceapprove' => 'approve',
+ 'deviceclear' => 'perm deleted',
);
protected $strings = array(
@@ -182,7 +184,17 @@ class HistoryController extends BaseController
'error_string' => 'Error: the device page is already approved',
),
-
+
+ 'deviceclear' => array(
+
+ 'action' => 'deviceclear',
+ 'check_status' => 'no',
+ 'to_status' => 'yes',
+ 'exec_string' => 'The device page has been permanently deleted. Just reload the page',
+ 'error_string' => 'Error: the device page has already been permanently deleted',
+// 'method' => 'oupdate',
+
+ ),
);
protected $types = array(
@@ -266,7 +278,7 @@ class HistoryController extends BaseController
),
- //page blocked or not
+ //device page blocked or not
'device' => array(
'clean_type' => 'device',
@@ -275,11 +287,11 @@ class HistoryController extends BaseController
'field_name' => '-deleted',
'actions' => array('devicehide','deviceshow'),
'group' => 'admin',
- 'types_to_show' => 'device_app,device',
+ 'types_to_show' => 'device_app,device,device_cl',
),
- //page blocked or not
+ //device page approved
'device_app' => array(
'clean_type' => 'device_app',
@@ -290,7 +302,18 @@ class HistoryController extends BaseController
'group' => 'admin',
),
-
+
+ //device page cleared
+ 'device_cl' => array(
+
+ 'clean_type' => 'device_cl',
+ 'model_name' => 'HardwareModel',
+ 'id_name' => 'id_hard',
+ 'field_name' => 'cleared',
+ 'actions' => array('deviceclear'),
+ 'group' => 'admin',
+
+ ),
);
public function __construct($model, $controller, $queryString)
@@ -366,6 +389,11 @@ class HistoryController extends BaseController
{
$this->generic($lang, $token, 'deviceapprove');
}
+
+ public function deviceclear($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'deviceclear');
+ }
protected function generic($lang = 'en', $token = '', $action = 'hide')
{
@@ -389,7 +417,7 @@ class HistoryController extends BaseController
$message = $this->request->post('message','');
$modelName = 'error';
-
+
if (array_key_exists($type,$this->types))
{
if (in_array($action,$this->types[$type]['actions']))
@@ -406,8 +434,10 @@ class HistoryController extends BaseController
$this->model($modelName);
$model = $this->m[$modelName];
- $count = $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status']))->rowNumber();
+ $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status']));
+ $count = $model->rowNumber();
+
if ($count > 0)
{
if (eg_strlen($message) < 500)
@@ -417,7 +447,15 @@ class HistoryController extends BaseController
//hide the message
$model->values = array($clean['field_name'] => $this->strings[$action]['to_status']);
- $model->pUpdate($clean['id']);
+
+ if (isset($this->strings[$action]['method']))
+ {
+ call_user_func(array($model, $this->strings[$action]['method']),$clean['id']);
+ }
+ else
+ {
+ $model->pUpdate($clean['id']);
+ }
if ($model->queryResult)
{
@@ -533,6 +571,7 @@ class HistoryController extends BaseController
'devicehide' => 'hidden',
'deviceshow' => 'restored',
'deviceapprove' => 'approved',
+ 'deviceclear' => 'permanently deleted',
);
$this->append($data);