began adminlists, severall design fixes
This commit is contained in:
parent
337e6e18f9
commit
7a15aef94d
152
application/core/Admin/AdminLists.php
Normal file
152
application/core/Admin/AdminLists.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Lukas
|
||||||
|
* Date: 31.01.14
|
||||||
|
* Time: 12:54
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ManiaControl\Admin;
|
||||||
|
|
||||||
|
|
||||||
|
use FML\Controls\Frame;
|
||||||
|
use FML\Controls\Labels\Label_Text;
|
||||||
|
use FML\Controls\Quads\Quad_BgRaceScore2;
|
||||||
|
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||||
|
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
||||||
|
use FML\ManiaLink;
|
||||||
|
use FML\Script\Script;
|
||||||
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
|
class AdminLists implements ManialinkPageAnswerListener {
|
||||||
|
/**
|
||||||
|
* Constants
|
||||||
|
*/
|
||||||
|
const ACTION_OPEN_ADMINLISTS = "AdminList.OpenAdminLists";
|
||||||
|
const MAX_PLAYERS_PER_PAGE = 15;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a PlayerList Instance
|
||||||
|
*
|
||||||
|
* @param ManiaControl $maniaControl
|
||||||
|
*/
|
||||||
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
|
/*$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CLOSE_PLAYER_ADV, $this, 'closePlayerAdvancedWidget');
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget');
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened');
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
|
|
||||||
|
// Update Widget Events
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidget');
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'updateWidget');
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'updateWidget');
|
||||||
|
$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget');*/
|
||||||
|
|
||||||
|
// Action Open Playerlist
|
||||||
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMINLISTS, $this, 'openAdminList');
|
||||||
|
$itemQuad = new Quad_UIConstruction_Buttons();
|
||||||
|
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author);
|
||||||
|
$itemQuad->setAction(self::ACTION_OPEN_ADMINLISTS);
|
||||||
|
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, false, 14, 'Open Adminlist');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function openAdminList(array $callback, Player $player) {
|
||||||
|
$this->showAdminLists($player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showAdminLists(Player $player) {
|
||||||
|
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||||
|
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||||
|
|
||||||
|
// get PlayerList
|
||||||
|
// $admins = $this->maniaControl->authenticationManager->
|
||||||
|
/*$players = $this->maniaControl->playerManager->getPlayers();
|
||||||
|
$pagesId = '';
|
||||||
|
if (count($players) > self::MAX_PLAYERS_PER_PAGE) {
|
||||||
|
$pagesId = 'AdminListsPages';
|
||||||
|
}*/
|
||||||
|
$pagesId = 'AdminListsPages';
|
||||||
|
|
||||||
|
|
||||||
|
//create manialink
|
||||||
|
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||||
|
$script = $maniaLink->getScript();
|
||||||
|
|
||||||
|
// Main frame
|
||||||
|
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
|
||||||
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
|
// Start offsets
|
||||||
|
$x = -$width / 2;
|
||||||
|
//Predefine description Label
|
||||||
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
|
$frame->add($descriptionLabel);
|
||||||
|
|
||||||
|
$admins = $this->maniaControl->authenticationManager->getAdmins();
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
$y = $height / 2 - 10;
|
||||||
|
$pageFrames = array();
|
||||||
|
foreach($admins as $admin) {
|
||||||
|
if (!isset($pageFrame)) {
|
||||||
|
$pageFrame = new Frame();
|
||||||
|
$frame->add($pageFrame);
|
||||||
|
if (!empty($pageFrames)) {
|
||||||
|
$pageFrame->setVisible(false);
|
||||||
|
}
|
||||||
|
array_push($pageFrames, $pageFrame);
|
||||||
|
$y = $height / 2 - 10;
|
||||||
|
$script->addPage($pageFrame, count($pageFrames), $pagesId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$playerFrame = new Frame();
|
||||||
|
$pageFrame->add($playerFrame);
|
||||||
|
$playerFrame->setY($y);
|
||||||
|
|
||||||
|
if ($i % 2 != 0) {
|
||||||
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
|
$playerFrame->add($lineQuad);
|
||||||
|
$lineQuad->setSize($width, 4);
|
||||||
|
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
|
||||||
|
$lineQuad->setZ(0.001);
|
||||||
|
}
|
||||||
|
|
||||||
|
$array = array($i => $x + 5, $admin->nickname => $x + 18, $admin->login => $x + 70);
|
||||||
|
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
|
||||||
|
|
||||||
|
|
||||||
|
// Level Quad
|
||||||
|
$rightQuad = new Quad_BgRaceScore2();
|
||||||
|
$playerFrame->add($rightQuad);
|
||||||
|
$rightQuad->setX($x + 13);
|
||||||
|
$rightQuad->setZ(5);
|
||||||
|
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
|
||||||
|
$rightQuad->setSize(7, 3.5);
|
||||||
|
|
||||||
|
$rightLabel = new Label_Text();
|
||||||
|
$playerFrame->add($rightLabel);
|
||||||
|
$rightLabel->setX($x + 13.9);
|
||||||
|
$rightLabel->setTextSize(0.8);
|
||||||
|
$rightLabel->setZ(10);
|
||||||
|
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($admin->authLevel));
|
||||||
|
$script->addTooltip($rightLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel) . " " . $admin->nickname));
|
||||||
|
|
||||||
|
|
||||||
|
$y -= 4;
|
||||||
|
$i++;
|
||||||
|
if ($i % self::MAX_PLAYERS_PER_PAGE == 0) {
|
||||||
|
unset($pageFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render and display xml
|
||||||
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'AdminList');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Admin;
|
namespace ManiaControl\Admin;
|
||||||
|
|
||||||
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class managing Authentication Levels
|
* Class managing Authentication Levels
|
||||||
@ -17,18 +17,18 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const AUTH_LEVEL_PLAYER = 0;
|
const AUTH_LEVEL_PLAYER = 0;
|
||||||
const AUTH_LEVEL_MODERATOR = 1;
|
const AUTH_LEVEL_MODERATOR = 1;
|
||||||
const AUTH_LEVEL_ADMIN = 2;
|
const AUTH_LEVEL_ADMIN = 2;
|
||||||
const AUTH_LEVEL_SUPERADMIN = 3;
|
const AUTH_LEVEL_SUPERADMIN = 3;
|
||||||
const AUTH_LEVEL_MASTERADMIN = 4;
|
const AUTH_LEVEL_MASTERADMIN = 4;
|
||||||
const CB_AUTH_LEVEL_CHANGED = 'AuthenticationManager.AuthLevelChanged';
|
const CB_AUTH_LEVEL_CHANGED = 'AuthenticationManager.AuthLevelChanged';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Properties
|
* Public Properties
|
||||||
*/
|
*/
|
||||||
public $authCommands = null;
|
public $authCommands = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private Properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
@ -42,7 +42,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
$this->authCommands = new AuthCommands($maniaControl);
|
$this->authCommands = new AuthCommands($maniaControl);
|
||||||
|
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,9 +57,9 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
*/
|
*/
|
||||||
private function updateMasterAdmins() {
|
private function updateMasterAdmins() {
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
|
||||||
// Remove all MasterAdmins
|
// Remove all MasterAdmins
|
||||||
$adminQuery = "UPDATE `" . PlayerManager::TABLE_PLAYERS . "`
|
$adminQuery = "UPDATE `" . PlayerManager::TABLE_PLAYERS . "`
|
||||||
SET `authLevel` = ?
|
SET `authLevel` = ?
|
||||||
WHERE `authLevel` = ?;";
|
WHERE `authLevel` = ?;";
|
||||||
$adminStatement = $mysqli->prepare($adminQuery);
|
$adminStatement = $mysqli->prepare($adminQuery);
|
||||||
@ -67,7 +67,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
trigger_error($mysqli->error, E_USER_ERROR);
|
trigger_error($mysqli->error, E_USER_ERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$adminLevel = self::AUTH_LEVEL_SUPERADMIN;
|
$adminLevel = self::AUTH_LEVEL_SUPERADMIN;
|
||||||
$masterAdminLevel = self::AUTH_LEVEL_MASTERADMIN;
|
$masterAdminLevel = self::AUTH_LEVEL_MASTERADMIN;
|
||||||
$adminStatement->bind_param('ii', $adminLevel, $masterAdminLevel);
|
$adminStatement->bind_param('ii', $adminLevel, $masterAdminLevel);
|
||||||
$adminStatement->execute();
|
$adminStatement->execute();
|
||||||
@ -75,10 +75,10 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
trigger_error($adminStatement->error);
|
trigger_error($adminStatement->error);
|
||||||
}
|
}
|
||||||
$adminStatement->close();
|
$adminStatement->close();
|
||||||
|
|
||||||
// Set MasterAdmins
|
// Set MasterAdmins
|
||||||
$masterAdmins = $this->maniaControl->config->masteradmins->xpath('login');
|
$masterAdmins = $this->maniaControl->config->masteradmins->xpath('login');
|
||||||
$adminQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` (
|
$adminQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` (
|
||||||
`login`,
|
`login`,
|
||||||
`authLevel`
|
`authLevel`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
@ -92,8 +92,8 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
}
|
}
|
||||||
$adminStatement->bind_param('si', $login, $masterAdminLevel);
|
$adminStatement->bind_param('si', $login, $masterAdminLevel);
|
||||||
$success = true;
|
$success = true;
|
||||||
foreach ($masterAdmins as $masterAdmin) {
|
foreach($masterAdmins as $masterAdmin) {
|
||||||
$login = (string) $masterAdmin;
|
$login = (string)$masterAdmin;
|
||||||
$adminStatement->execute();
|
$adminStatement->execute();
|
||||||
if ($adminStatement->error) {
|
if ($adminStatement->error) {
|
||||||
trigger_error($adminStatement->error);
|
trigger_error($adminStatement->error);
|
||||||
@ -104,20 +104,51 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a List of all Admins
|
||||||
|
*
|
||||||
|
* @param $authLevel
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
public function getAdmins($authLevel = -1) {
|
||||||
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
|
||||||
|
if ($authLevel == -1) {
|
||||||
|
$query = "SELECT * FROM `" . PlayerManager::TABLE_PLAYERS . "` WHERE `authLevel` > 0 ORDER BY `authLevel` DESC;";
|
||||||
|
} else {
|
||||||
|
$query = "SELECT * FROM `" . PlayerManager::TABLE_PLAYERS . "` WHERE `authLevel` = " . $authLevel . ";";
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $mysqli->query($query);
|
||||||
|
if (!$result) {
|
||||||
|
trigger_error($mysqli->error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$admins = array();
|
||||||
|
while($row = $result->fetch_object()) {
|
||||||
|
array_push($admins, $row);
|
||||||
|
}
|
||||||
|
return $admins;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grant the Auth Level to the Player
|
* Grant the Auth Level to the Player
|
||||||
*
|
*
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param int $authLevel
|
* @param int $authLevel
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function grantAuthLevel(Player &$player, $authLevel) {
|
public function grantAuthLevel(Player &$player, $authLevel) {
|
||||||
if (!$player || !is_numeric($authLevel)) return false;
|
if (!$player || !is_numeric($authLevel)) {
|
||||||
$authLevel = (int) $authLevel;
|
return false;
|
||||||
if ($authLevel >= self::AUTH_LEVEL_MASTERADMIN) return false;
|
}
|
||||||
|
$authLevel = (int)$authLevel;
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
if ($authLevel >= self::AUTH_LEVEL_MASTERADMIN)
|
||||||
$authQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` (
|
return false;
|
||||||
|
|
||||||
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
$authQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` (
|
||||||
`login`,
|
`login`,
|
||||||
`authLevel`
|
`authLevel`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
@ -137,10 +168,10 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$authStatement->close();
|
$authStatement->close();
|
||||||
|
|
||||||
$player->authLevel = $authLevel;
|
$player->authLevel = $authLevel;
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_AUTH_LEVEL_CHANGED, array(self::CB_AUTH_LEVEL_CHANGED, $player));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_AUTH_LEVEL_CHANGED, array(self::CB_AUTH_LEVEL_CHANGED, $player));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +182,8 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function sendNotAllowed(Player $player) {
|
public function sendNotAllowed(Player $player) {
|
||||||
if (!$player) return false;
|
if (!$player)
|
||||||
|
return false;
|
||||||
return $this->maniaControl->chat->sendError('You do not have the required Rights to perform this Command!', $player->login);
|
return $this->maniaControl->chat->sendError('You do not have the required Rights to perform this Command!', $player->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +191,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
* Check if the Player has enough Rights
|
* Check if the Player has enough Rights
|
||||||
*
|
*
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param int $neededAuthLevel
|
* @param int $neededAuthLevel
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function checkRight(Player $player, $neededAuthLevel) {
|
public static function checkRight(Player $player, $neededAuthLevel) {
|
||||||
@ -170,7 +202,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
* Checks the permission by a right name
|
* Checks the permission by a right name
|
||||||
*
|
*
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param $rightName
|
* @param $rightName
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkPermission(Player $player, $rightName) {
|
public function checkPermission(Player $player, $rightName) {
|
||||||
@ -229,7 +261,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
if ($authLevelInt == self::AUTH_LEVEL_MODERATOR) {
|
if ($authLevelInt == self::AUTH_LEVEL_MODERATOR) {
|
||||||
return 'MOD';
|
return 'MOD';
|
||||||
}
|
}
|
||||||
return 'PL';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,17 +127,12 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener
|
|||||||
$pagesId = 'MxListPages';
|
$pagesId = 'MxListPages';
|
||||||
|
|
||||||
// Main frame
|
// Main frame
|
||||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
|
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Predefine Description Label
|
//Predefine description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
|
||||||
$descriptionLabel->setPosition($x + 10, -$height / 2 + 5);
|
|
||||||
$descriptionLabel->setSize($width * 0.7, 4);
|
|
||||||
$descriptionLabel->setTextSize(2);
|
|
||||||
$descriptionLabel->setVisible(false);
|
|
||||||
|
|
||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
|
@ -4,6 +4,7 @@ namespace ManiaControl\Manialinks;
|
|||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
|
use FML\Controls\Label;
|
||||||
use FML\Controls\Labels\Label_Text;
|
use FML\Controls\Labels\Label_Text;
|
||||||
use FML\Controls\Quad;
|
use FML\Controls\Quad;
|
||||||
use FML\Controls\Quads\Quad_BgRaceScore2;
|
use FML\Controls\Quads\Quad_BgRaceScore2;
|
||||||
@ -130,12 +131,32 @@ class StyleManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Default Description Label
|
||||||
|
*
|
||||||
|
* @return Label
|
||||||
|
*/
|
||||||
|
public function getDefaultDescriptionLabel() {
|
||||||
|
$width = $this->getListWidgetsWidth();
|
||||||
|
$height = $this->getListWidgetsHeight();
|
||||||
|
|
||||||
|
// Predefine Description Label
|
||||||
|
$descriptionLabel = new Label();
|
||||||
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
|
$descriptionLabel->setPosition(-$width / 2 + 10, -$height / 2 + 5);
|
||||||
|
$descriptionLabel->setSize($width * 0.7, 4);
|
||||||
|
$descriptionLabel->setTextSize(2);
|
||||||
|
$descriptionLabel->setVisible(false);
|
||||||
|
|
||||||
|
return $descriptionLabel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the Default List Frame
|
* Builds the Default List Frame
|
||||||
*
|
*
|
||||||
* @return Frame $frame
|
* @return Frame $frame
|
||||||
*/
|
*/
|
||||||
public function defaultListFrame(Script $script = null, $pagesId = '') {
|
public function getDefaultListFrame(Script $script = null, $pagesId = '') {
|
||||||
$width = $this->getListWidgetsWidth();
|
$width = $this->getListWidgetsWidth();
|
||||||
$height = $this->getListWidgetsHeight();
|
$height = $this->getListWidgetsHeight();
|
||||||
$quadStyle = $this->getDefaultMainWindowStyle();
|
$quadStyle = $this->getDefaultMainWindowStyle();
|
||||||
|
@ -119,7 +119,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$script = $maniaLink->getScript();
|
$script = $maniaLink->getScript();
|
||||||
|
|
||||||
// Main frame
|
// Main frame
|
||||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
|
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
//Admin Buttons
|
//Admin Buttons
|
||||||
@ -176,14 +176,9 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$array = array('Id' => $x + 5, 'Mx Id' => $x + 10, 'Map Name' => $x + 20, 'Author' => $x + 68, 'Karma' => $x + 115, 'Actions' => $width / 2 - 15);
|
$array = array('Id' => $x + 5, 'Mx Id' => $x + 10, 'Map Name' => $x + 20, 'Author' => $x + 68, 'Karma' => $x + 115, 'Actions' => $width / 2 - 15);
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
// Predefine Description Label
|
//Predefine description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
|
||||||
$descriptionLabel->setPosition($x + 10, -$height / 2 + 5);
|
|
||||||
$descriptionLabel->setSize($width * 0.7, 4);
|
|
||||||
$descriptionLabel->setTextSize(2);
|
|
||||||
$descriptionLabel->setVisible(false);
|
|
||||||
|
|
||||||
$queuedMaps = $this->maniaControl->mapManager->mapQueue->getQueuedMapsRanking();
|
$queuedMaps = $this->maniaControl->mapManager->mapQueue->getQueuedMapsRanking();
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +55,7 @@ class PlayerDetailed {
|
|||||||
$script = $maniaLink->getScript();
|
$script = $maniaLink->getScript();
|
||||||
|
|
||||||
// Main frame
|
// Main frame
|
||||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script);
|
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script);
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Create script and features
|
// Create script and features
|
||||||
|
@ -4,7 +4,6 @@ namespace ManiaControl\Players;
|
|||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
use FML\Controls\Label;
|
|
||||||
use FML\Controls\Labels\Label_Button;
|
use FML\Controls\Labels\Label_Button;
|
||||||
use FML\Controls\Labels\Label_Text;
|
use FML\Controls\Labels\Label_Text;
|
||||||
use FML\Controls\Quad;
|
use FML\Controls\Quad;
|
||||||
@ -82,6 +81,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Player to Shown List
|
* Add Player to Shown List
|
||||||
|
*
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param int $showStatus
|
* @param int $showStatus
|
||||||
*/
|
*/
|
||||||
@ -110,7 +110,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$script = $maniaLink->getScript();
|
$script = $maniaLink->getScript();
|
||||||
|
|
||||||
// Main frame
|
// Main frame
|
||||||
$frame = $this->maniaControl->manialinkManager->styleManager->defaultListFrame($script, $pagesId);
|
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId);
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
@ -118,13 +118,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$y = $height / 2;
|
$y = $height / 2;
|
||||||
|
|
||||||
// Predefine Description Label
|
// Predefine Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = $this->maniaControl->manialinkManager->styleManager->getDefaultDescriptionLabel();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
|
||||||
$descriptionLabel->setPosition($x + 10, -$height / 2 + 5);
|
|
||||||
$descriptionLabel->setSize($width * 0.7, 4);
|
|
||||||
$descriptionLabel->setTextSize(2);
|
|
||||||
$descriptionLabel->setVisible(false);
|
|
||||||
|
|
||||||
// Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
@ -225,6 +220,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
$rightLabel->setX($x + 13.9);
|
$rightLabel->setX($x + 13.9);
|
||||||
$rightLabel->setTextSize(0.8);
|
$rightLabel->setTextSize(0.8);
|
||||||
$rightLabel->setZ(10);
|
$rightLabel->setZ(10);
|
||||||
|
$rightLabel->setText($this->maniaControl->authenticationManager->getAuthLevelAbbreviation($listPlayer->authLevel));
|
||||||
|
$rightLabel->setTextColor("fff");
|
||||||
|
|
||||||
$script->addTooltip($rightLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname));
|
$script->addTooltip($rightLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => $this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname));
|
||||||
|
|
||||||
@ -260,22 +257,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
// Description Label
|
// Description Label
|
||||||
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View Player profile of " . $listPlayer->nickname));
|
$script->addTooltip($playerQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View Player profile of " . $listPlayer->nickname));
|
||||||
|
|
||||||
switch($listPlayer->authLevel) {
|
|
||||||
case authenticationManager::AUTH_LEVEL_MASTERADMIN:
|
|
||||||
$rightLabel->setText("MA");
|
|
||||||
break;
|
|
||||||
case authenticationManager::AUTH_LEVEL_SUPERADMIN:
|
|
||||||
$rightLabel->setText("SA");
|
|
||||||
break;
|
|
||||||
case authenticationManager::AUTH_LEVEL_ADMIN:
|
|
||||||
$rightLabel->setText("AD");
|
|
||||||
break;
|
|
||||||
case authenticationManager::AUTH_LEVEL_MODERATOR:
|
|
||||||
$rightLabel->setText("MOD");
|
|
||||||
}
|
|
||||||
|
|
||||||
$rightLabel->setTextColor("fff");
|
|
||||||
|
|
||||||
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||||
// Further Player actions Quad
|
// Further Player actions Quad
|
||||||
$playerQuad = new Quad_Icons64x64_1();
|
$playerQuad = new Quad_Icons64x64_1();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Players;
|
namespace ManiaControl\Players;
|
||||||
|
|
||||||
|
use ManiaControl\Admin\AdminLists;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Formatter;
|
use ManiaControl\Formatter;
|
||||||
@ -33,6 +34,7 @@ class PlayerManager implements CallbackListener {
|
|||||||
public $playerCommands = null;
|
public $playerCommands = null;
|
||||||
public $playerDetailed = null;
|
public $playerDetailed = null;
|
||||||
public $playerList = null;
|
public $playerList = null;
|
||||||
|
public $adminLists = null;
|
||||||
public $players = array();
|
public $players = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,6 +55,7 @@ class PlayerManager implements CallbackListener {
|
|||||||
$this->playerActions = new PlayerActions($maniaControl);
|
$this->playerActions = new PlayerActions($maniaControl);
|
||||||
$this->playerDetailed = new PlayerDetailed($maniaControl);
|
$this->playerDetailed = new PlayerDetailed($maniaControl);
|
||||||
$this->playerList = new PlayerList($this->maniaControl);
|
$this->playerList = new PlayerList($this->maniaControl);
|
||||||
|
$this->adminLists = new AdminLists($this->maniaControl);
|
||||||
|
|
||||||
// Init settings
|
// Init settings
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user