From e9973f35a33f0ad72ff2fbd74250283d0e23e375 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Fri, 25 Feb 2011 00:25:29 +0000 Subject: added list of actions carried out by administrators --- .../Application/Controllers/HistoryController.php | 25 +++++- .../Application/Controllers/LastController.php | 91 ++++++++++++++++++---- .../Controllers/ModeratorsController.php | 68 ---------------- h-source/Application/Controllers/MyController.php | 2 +- h-source/Application/Include/languages.php | 10 +-- h-source/Application/Include/myFunctions.php | 33 ++++++-- h-source/Application/Views/Last/modactions.php | 74 ++++++++++++++++++ h-source/Application/Views/Meet/meet.php | 2 +- h-source/Application/Views/Moderators/index.php | 74 ------------------ h-source/Application/Views/My/panel.php | 14 ++-- h-source/Config/Route.php | 3 +- h-source/Public/Css/main.css | 14 ++-- 12 files changed, 223 insertions(+), 187 deletions(-) delete mode 100644 h-source/Application/Controllers/ModeratorsController.php create mode 100644 h-source/Application/Views/Last/modactions.php delete mode 100644 h-source/Application/Views/Moderators/index.php diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index ac1ab1a..e44ce79 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -23,6 +23,29 @@ if (!defined('EG')) die('Direct access not allowed!'); class HistoryController extends BaseController { + public static $typeTable = array( + 'message' => 'message', + 'talk' => 'talk', + 'user' => 'user', + 'issue' => 'issue', + 'wiki_talk' => 'wiki talk', + 'page' => 'wiki page', + 'page_del' => 'wiki page', + ); + + public static $actionTable = array( + 'hide' => 'hide', + 'show' => 'show', + 'block' => 'block', + 'unblock' => 'unblock', + 'open' => 'open', + 'close' => 'close', + 'pageblock' => 'block', + 'pageunblock' => 'unblock', + 'pagehide' => 'hide', + 'pageshow' => 'show', + ); + protected $strings = array( 'hide' => array( @@ -157,7 +180,7 @@ class HistoryController extends BaseController 'id_name' => 'id_user', 'field_name' => 'blocked', 'actions' => array('block','unblock'), - 'group' => 'moderator', + 'group' => 'admin', ), diff --git a/h-source/Application/Controllers/LastController.php b/h-source/Application/Controllers/LastController.php index 6fe66a2..2050ea7 100644 --- a/h-source/Application/Controllers/LastController.php +++ b/h-source/Application/Controllers/LastController.php @@ -34,32 +34,89 @@ class LastController extends BaseController $this->setArgKeys(array('page:forceNat'=>1)); } - - public function modifications($lang = 'en') + + protected function last($lang = 'en',$action = 'modifications') { - $this->shift(1); - - $whereClauseArray = array( - 'gr' => 'registered', - 'type' => 'hardware', - ); - - $this->helper('Pages','last/modifications/'.$this->lang,'page'); - + switch ($action) + { + case 'modifications': + $data['title'] = 'last modifications - '.Website::$generalName; + + $whereClauseArray = array( + 'gr' => 'registered', + 'type' => 'hardware', + ); + + $viewFile = 'modifications'; + + break; + case 'modactions': + $data['title'] = 'last moderations - '.Website::$generalName; + $data['viewTitle'] = 'List of actions carried out by moderators'; + $data['user_status'] = 'MODERATOR'; + + $whereClauseArray = array( + 'gr' => 'moderator', + ); + + $viewFile = 'modactions'; + + break; + case 'adminactions': + $data['title'] = 'last admin actions - '.Website::$generalName; + $data['viewTitle'] = 'List of actions carried out by administrators'; + $data['user_status'] = 'ADMINISTRATOR'; + + $whereClauseArray = array( + 'gr' => 'admin', + ); + + $viewFile = 'modactions'; + + break; + } + + $this->helper('Pages','last/'.$this->action.'/'.$this->lang,'page'); + $this->m['HistoryModel']->clear()->select()->where($whereClauseArray)->orderBy('id_history desc'); - + $recordNumber = $this->m['HistoryModel']->rowNumber(); $page = $this->viewArgs['page']; - + $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30); - + $data['table'] = $this->m['HistoryModel']->send(); - + $data['pageList'] = $this->h['Pages']->render($page-5,11); - + $this->append($data); - $this->load('modifications'); + $this->load($viewFile); $this->right(); } + public function modifications($lang = 'en') + { + $this->shift(1); + + $this->last($lang = 'en','modifications'); + } + + public function modactions($lang = 'en') + { + $this->shift(1); + + $this->s['registered']->check('moderator'); + + $this->last($lang = 'en','modactions'); + } + + public function adminactions($lang = 'en') + { + $this->shift(1); + + $this->s['registered']->check('admin'); + + $this->last($lang = 'en','adminactions'); + } + } \ No newline at end of file diff --git a/h-source/Application/Controllers/ModeratorsController.php b/h-source/Application/Controllers/ModeratorsController.php deleted file mode 100644 index 2f4123f..0000000 --- a/h-source/Application/Controllers/ModeratorsController.php +++ /dev/null @@ -1,68 +0,0 @@ -. - -if (!defined('EG')) die('Direct access not allowed!'); - -class ModeratorsController extends BaseController -{ - - public function __construct($model, $controller, $queryString) - { - parent::__construct($model, $controller, $queryString); - - $this->model('HistoryModel'); - - $this->modelName = 'HistoryModel'; - - $data['title'] = 'moderators page - '.Website::$generalName; - $this->append($data); - - $this->setArgKeys(array('page:forceNat'=>1)); - } - - public function actions($lang = 'en') - { - $this->shift(1); - - $this->s['registered']->check('moderator'); - - $whereClauseArray = array( - 'gr' => 'moderator', - ); - - $this->helper('Pages','moderators/actions/'.$this->lang,'page'); - - $this->m['HistoryModel']->clear()->select()->where($whereClauseArray)->orderBy('id_history desc'); - - $recordNumber = $this->m['HistoryModel']->rowNumber(); - $page = $this->viewArgs['page']; - - $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30); - - $data['table'] = $this->m['HistoryModel']->send(); - - $data['pageList'] = $this->h['Pages']->render($page-4,8); - - $this->append($data); - $this->load('index'); - $this->right(); - } - -} \ No newline at end of file diff --git a/h-source/Application/Controllers/MyController.php b/h-source/Application/Controllers/MyController.php index d1e346c..69b8da7 100644 --- a/h-source/Application/Controllers/MyController.php +++ b/h-source/Application/Controllers/MyController.php @@ -50,7 +50,7 @@ class MyController extends BaseController $clean['id_user'] = (int)$this->s['registered']->status['id_user']; $data['username'] = $this->m['UsersModel']->getUser($clean['id_user']); - $data['isBlocked'] = $this->m['UsersModel']->isBlocked($clean['id_user']); + $data['userBlocked'] = $this->m['UsersModel']->isBlocked($clean['id_user']); $this->append($data); $this->load('panel'); diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index d8e6502..ee4fdcc 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -127,8 +127,7 @@ class Lang "confirm the password" => "conferma la password", "write the code above" => "scrivi il codice mostrato sopra", "write your username" => "scrivi il tuo username", - "watch all the" => "guarda tutte le", - "actions carried out by moderators" => "azioni compiute dai moderatori", + "Watch all the actions carried out by moderators" => "Guarda tutte le azioni compiute dai moderatori", "meet" => "conosci", "Public profile of" => "Profilo pubblico di", "See all the contributions of" => "Guarda tutti i contributi di ", @@ -212,6 +211,7 @@ class Lang "delete the wiki page" => "cancella la pagina", "list of blocked pages" => "lista delle pagine bloccate", "special pages" => "pagine speciali", + "Watch all the actions carried out by administrators" => "Guarda tutte le azioni compiute dagli amministratori" ), 'es' => array ( @@ -307,8 +307,7 @@ class Lang "confirm the password" => "confirme la contraseña", "write the code above" => "escriba el código mostrado superior", "write your username" => "escriba su nombre de usuario", - "watch all the" => "ver todas las", - "actions carried out by moderators" => "acciones efectuadas por los moderadores", + "Watch all the actions carried out by moderators" => "Ver todas las acciones efectuadas por los moderadores", "meet" => "conoce", "Public profile of" => "Perfil público de", "See all the contributions of" => "Ver todas las contribuciones de", @@ -489,8 +488,7 @@ class Lang "confirm the password" => "confirmez le mot de passe", "write the code above" => "écrivez le code si-dessous", "write your username" => "écrivez votre nom d'utilisateur", - "watch all the" => "regardez toutes les", - "actions carried out by moderators" => "actions prises par les modérateurs", + "Watch all the actions carried out by moderators" => "Regardez toutes les actions prises par les modérateurs", "meet" => "rencontrer", "Public profile of" => "Profil public de", "See all the contributions of" => "Voir toute les distributions de", diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index 9e05ed2..ddbc16f 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -484,7 +484,7 @@ function getHardwareInfoFromTalkId($id = 0) $clean['id'] = (int)$id; $talk = new TalkModel(); $res = $talk->select('hardware.type,hardware.id_hard')->from('hardware inner join talk')->using('id_hard')->where(array('id_talk'=>$clean['id']))->send(); - return $res[0]['hardware']; + return count($res) > 0 ? $res[0]['hardware'] : null; } //get the wiki page info from the talk id @@ -493,7 +493,7 @@ function getWikiPageInfoFromTalkId($id = 0) $clean['id'] = (int)$id; $talk = new WikitalkModel(); $res = $talk->select('wiki.id_wiki')->from('wiki inner join wiki_talk')->using('id_wiki')->where(array('id_talk'=>$clean['id']))->send(); - return $res[0]['wiki']['id_wiki']; + return count($res) > 0 ? $res[0]['wiki']['id_wiki'] : ''; } //get the issue info from the message id @@ -502,7 +502,16 @@ function getIssueNumberFromMessageId($id = 0) $clean['id'] = (int)$id; $mess = new MessagesModel(); $res = $mess->select('issues.id_issue')->from('issues inner join messages')->using('id_issue')->where(array('id_mes'=>$clean['id']))->toList('issues.id_issue')->send(); - return $res[0]; + return count($res) > 0 ? $res[0] : ''; +} + +//get thw wiki name from the id +function getWikiNameFromId($id = 0) +{ + $clean['id'] = (int)$id; + $wiki = new WikiModel(); + $name = $wiki->getTheModelName($clean['id']); + return $name; } //return the URL to the moderated object page @@ -517,8 +526,15 @@ function goToModeratedItem( $row = array() ) break; case 'talk': $hardInfo = getHardwareInfoFromTalkId($row['id']); - $controller = Hardware::$typeToController[$hardInfo['type']]; - $url = $controller.'/talk/'.Lang::$current.'/'.$hardInfo['id_hard'].'#talk-'.$row['id']; + if (isset($hardInfo)) + { + $controller = Hardware::$typeToController[$hardInfo['type']]; + $url = $controller.'/talk/'.Lang::$current.'/'.$hardInfo['id_hard'].'#talk-'.$row['id']; + } + else + { + $url = 'last/modactions/'.Lang::$current; + } break; case 'user': $url = 'meet/user/'.Lang::$current.'/'.getUserName($row['id']); @@ -529,7 +545,12 @@ function goToModeratedItem( $row = array() ) case 'wiki_talk': $url = 'wiki/talk/'.Lang::$current.'/'.getWikiPageInfoFromTalkId($row['id']).'#wiki-talk-'.$row['id']; break; - + case 'page': + $url = 'wiki/page/'.Lang::$current.'/'.encodeUrl(getWikiNameFromId($row['id'])); + break; + case 'page_del': + $url = 'wiki/page/'.Lang::$current.'/'.encodeUrl(getWikiNameFromId($row['id'])); + break; } return 'http://'.DOMAIN_NAME.'/'.$url; } diff --git a/h-source/Application/Views/Last/modactions.php b/h-source/Application/Views/Last/modactions.php new file mode 100644 index 0000000..fe50223 --- /dev/null +++ b/h-source/Application/Views/Last/modactions.php @@ -0,0 +1,74 @@ + + +. +?> + +
+ +
+ ">Home » ">panel » moderators' actions +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
ACTION IDACTIONTYPEOBJECT IDDATEMOTIVATION
+ + + getUser($row['history']['created_by']);?> + + + + + + + + + + +
+ +
+ : +
+ +
diff --git a/h-source/Application/Views/Meet/meet.php b/h-source/Application/Views/Meet/meet.php index e52ef2a..f0e31b3 100644 --- a/h-source/Application/Views/Meet/meet.php +++ b/h-source/Application/Views/Meet/meet.php @@ -26,7 +26,7 @@ ">Home » - +
This user has been blocked diff --git a/h-source/Application/Views/Moderators/index.php b/h-source/Application/Views/Moderators/index.php deleted file mode 100644 index dabbf56..0000000 --- a/h-source/Application/Views/Moderators/index.php +++ /dev/null @@ -1,74 +0,0 @@ - - -. -?> - -
- -
- ">Home » ">panel » moderators' actions -
- -
- List of actions carried out by moderators -
- - - - - - - - - - - - - - - - - - - - - - -
ACTION IDMODERATORACTIONTYPEOBJECT IDDATEMOTIVATION
- - - getUser($row['history']['created_by']);?> - - - - - - - - - - -
- -
- : -
- -
diff --git a/h-source/Application/Views/My/panel.php b/h-source/Application/Views/My/panel.php index 30e4d24..babf409 100644 --- a/h-source/Application/Views/My/panel.php +++ b/h-source/Application/Views/My/panel.php @@ -26,19 +26,19 @@ ">Home »
- +
Your account has been blocked by a moderator of the website. You can neither insert/modify devices nor submit new issues or messages until some other moderator un-block your account.
- - - -