From 98cde2db446345b80636fe933702d8fc72179965 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Wed, 29 Dec 2010 22:08:39 +0000 Subject: moderators can now open/close issues - part 1 --- .../Application/Controllers/HistoryController.php | 47 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'h-source/Application/Controllers/HistoryController.php') diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index 76b1158..f5ae1a2 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -65,6 +65,26 @@ class HistoryController extends BaseController ), + 'open' => array( + + 'action' => 'open', + 'check_status' => 'closed', + 'to_status' => 'opened', + 'exec_string' => 'The issue has been opened. Just reload the page', + 'error_string' => 'Error: the issue is already opened', + + ), + + 'close' => array( + + 'action' => 'close', + 'check_status' => 'opened', + 'to_status' => 'closed', + 'exec_string' => 'The issue has been closed. Just reload the page', + 'error_string' => 'Error: the issue is already closed', + + ), + ); protected $types = array( @@ -102,6 +122,17 @@ class HistoryController extends BaseController ), + 'issue' => array( + + 'clean_type' => 'issue', + 'model_name' => 'IssuesModel', + 'id_name' => 'id_issue', + 'field_name' => 'status', + 'actions' => array('open','close'), + 'group' => 'moderator', + + ), + ); public function __construct($model, $controller, $queryString) @@ -133,6 +164,16 @@ class HistoryController extends BaseController $this->generic($lang, $token, 'unblock'); } + public function open($lang = 'en', $token = '') + { + $this->generic($lang, $token, 'open'); + } + + public function close($lang = 'en', $token = '') + { + $this->generic($lang, $token, 'close'); + } + protected function generic($lang = 'en', $token = '', $action = 'hide') { header('Content-type: text/html; charset=UTF-8'); @@ -237,6 +278,10 @@ class HistoryController extends BaseController $data['object'] = 'user'; $data['box_class'] = 'details_of_actions_inner_user'; break; + case 'issue': + $data['object'] = 'issue'; + $data['box_class'] = 'details_of_actions_inner_user'; + break; default: $data['object'] = 'message'; $data['box_class'] = 'details_of_actions_inner'; @@ -245,7 +290,7 @@ class HistoryController extends BaseController $data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type'],'gr'=>$clean['group']))->send(); - $data['md_action'] = array('hide'=>'hidden','show'=>'restored','block'=>'blocked','unblock'=>'un-blocked'); + $data['md_action'] = array('hide'=>'hidden','show'=>'restored','block'=>'blocked','unblock'=>'un-blocked','open'=>'opened again','close'=>'closed'); $this->append($data); $this->load('viewall'); -- cgit v1.2.3