Skip to content

Commit

Permalink
convert admin templates to twig
Browse files Browse the repository at this point in the history
  • Loading branch information
g5bot authored and Huxinator committed Dec 7, 2023
1 parent fef648f commit c6b44fe
Show file tree
Hide file tree
Showing 24 changed files with 270 additions and 376 deletions.
10 changes: 0 additions & 10 deletions src/Module/Admin/Lib/UserlistEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,4 @@ public function getUserStateColor(): string
}
return '#dddddd';
}

public function isUserActive(): bool
{
return $this->user->getState() === UserEnum::USER_STATE_ACTIVE;
}

public function isUserLocked(): bool
{
return $this->user->isLocked();
}
}
2 changes: 1 addition & 1 deletion src/Module/Admin/View/Map/ShowMapInfluenceAreas.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle(GameControllerInterface $game): void
),
_('Einflussgebiete')
);
$game->setTemplateFile('html/admin/influenceareas.xhtml');
$game->setTemplateFile('html/admin/influenceareas.twig');

$game->setTemplateVar('GRAPH', $this->imageCreation->gdImageInSrc($this->buildImage($layer, $showAllyAreas !== 0)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Admin/View/MassMail/MassMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function handle(GameControllerInterface $game): void
),
_('Massen-Mails')
);
$game->setTemplateFile('html/admin/massmail.xhtml');
$game->setTemplateFile('html/admin/massMail.twig');
$game->setPageTitle(_('Massen-Mails'));
}
}
2 changes: 1 addition & 1 deletion src/Module/Admin/View/Playerlist/Playerlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function handle(GameControllerInterface $game): void
),
_('Spielerliste')
);
$game->setTemplateFile('html/admin/playerlist.xhtml');
$game->setTemplateFile('html/admin/playerList.twig');
$game->setPageTitle(_('Spielerliste'));
$game->setTemplateVar(
'LIST',
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Admin/View/ResearchTree/ShowResearchTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function handle(GameControllerInterface $game): void
),
_('Forschungsbaum')
);
$game->setTemplateFile('html/admin/tree.xhtml');
$game->setTemplateFile('html/admin/researchTree.twig');
$game->setPageTitle(_('Forschungsbaum'));
$game->setTemplateVar('TREE', $graphviz->createImageHtml($graph));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Admin/View/ShowSignatures/ShowSignatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function handle(GameControllerInterface $game): void

$game->setTemplateVar('DONOTHING', true);

$game->showMacro('html/admin/adminmacros.xhtml/signaturescan');
$game->setTemplateFile('html/admin/signatureScan.twig');

$signatureRange = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Module/Admin/View/ShowUserLock/ShowUserLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function handle(GameControllerInterface $game): void
$userIdToLock = request::getIntFatal('uid');

$game->setPageTitle(_('User-Lock setzen'));
$game->setMacroInAjaxWindow('html/admin/adminmacros.xhtml/user_lock');
$game->setMacroInAjaxWindow('html/admin/userLock.twig');

$game->setTemplateVar('USERID', $userIdToLock);
$game->setTemplateVar('LOCK', $this->userLockRepository->getActiveByUser($userIdToLock));
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Admin/View/Ticks/ShowTicks.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class ShowTicks implements ViewControllerInterface

public function handle(GameControllerInterface $game): void
{
$game->setTemplateFile('html/admin/ticks.xhtml');
$game->setTemplateFile('html/admin/ticks.twig');
$game->appendNavigationPart('/admin/?SHOW_TICKS=1', _('Ticks'));
$game->setPageTitle(_('Ticks'));
}
Expand Down
14 changes: 7 additions & 7 deletions src/Orm/Repository/UserRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getByResetToken(string $resetToken): ?UserInterface;
/**
* @param array<int> $ignoreIds
*
* @return iterable<UserInterface>
* @return array<UserInterface>
*/
public function getDeleteable(
int $idleTimeThreshold,
Expand All @@ -35,7 +35,7 @@ public function getDeleteable(
): iterable;

/**
* @return iterable<UserInterface>
* @return array<UserInterface>
*/
public function getIdleRegistrations(
int $idleTimeThreshold
Expand All @@ -50,7 +50,7 @@ public function getByLogin(string $loginName): ?UserInterface;
/**
* Returns all members of the given alliance
*
* @return iterable<UserInterface>
* @return array<UserInterface>
*/
public function getByAlliance(AllianceInterface $alliance): iterable;

Expand All @@ -65,12 +65,12 @@ public function getList(
): array;

/**
* @return iterable<UserInterface>
* @return array<UserInterface>
*/
public function getFriendsByUserAndAlliance(UserInterface $user, ?AllianceInterface $alliance): iterable;

/**
* @return iterable<UserInterface>
* @return array<UserInterface>
*/
public function getOrderedByLastaction(int $limit, int $ignoreUserId, int $lastActionThreshold): iterable;

Expand All @@ -83,12 +83,12 @@ public function getVacationAmount(): int;
public function getActiveAmountRecentlyOnline(int $threshold): int;

/**
* @return iterable<UserInterface>
* @return array<UserInterface>
*/
public function getNpcList(): iterable;

/**
* @return iterable<UserInterface>
* @return array<UserInterface>
*/
public function getNonNpcList(): iterable;

Expand Down
79 changes: 0 additions & 79 deletions src/html/admin/adminmacros.xhtml

This file was deleted.

12 changes: 12 additions & 0 deletions src/html/admin/influenceareas.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends "html/admindefaults.twig" %}

{% block body %}
{% include 'html/breadcrumb.twig' %}
<div>
<div>
{% autoescape false %}
{{ GRAPH }}
{% endautoescape %}
</div>
</div>
{% endblock %}
11 changes: 0 additions & 11 deletions src/html/admin/influenceareas.xhtml

This file was deleted.

43 changes: 43 additions & 0 deletions src/html/admin/massMail.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% extends "html/admindefaults.twig" %}

{% block body %}
{% include 'html/breadcrumb.twig' %}
<form action="/admin/index.php" method="post" name="massmailform" id="massmailform">
<input type="hidden" name="SHOW_MASS_MAIL" value="1" />
<input type="hidden" name="sstr" value="{{ SESSIONSTRING }}" />
<div style="float: left; width: 75%;">
<table class="tcal">
<tr>
<th>Empfangsmedium</th>
</tr>
<tr>
<td>
<label>
<input type="radio" name="medium" value="1" /> via E-Mail
</label>
<label>
<input type="radio" name="medium" value="2" /> via PM
</label>
</td>
</tr>
<tr>
<th>Betreff</th>
</tr>
<tr>
<td><input type="text" style="width: 100%" name="subject" value="Wichtige Information" /></td>
</tr>
<tr>
<th>Text</th>
</tr>
<tr>
<td><textarea name="text" style="width: 100%; height: 300px;"></textarea></td>
</tr>
<tr>
<td>
<input type="submit" name="B_MASS_MAIL" value="Absenden" />
</td>
</tr>
</table>
</div>
</form>
{% endblock %}
46 changes: 0 additions & 46 deletions src/html/admin/massmail.xhtml

This file was deleted.

62 changes: 62 additions & 0 deletions src/html/admin/playerList.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{% from 'html/macros.twig' import userAvatar, userInfo, pmWindow, userProfile %}

{% extends "html/admindefaults.twig" %}

{% block body %}
{% include 'html/breadcrumb.twig' %}
<div class="userList">
{% for listEntry in LIST %}
{% set user = listEntry.getUser %}
{% set userId = user.getId %}
<div class="userListItem">
<div>
{{ userAvatar(user) }}
</div>
<div>
<div class="userListItemName">
{{ userInfo(user) }}
</div>
<div class="userListItemAllianceName">
{% set alliance = user.getAlliance %}
{% if alliance %}
<a href="/alliance.php?id={{ alliance.getId }}">{{ alliance.getName|bbcode }}</a>
{% else %}
<span>-</span>
{% endif %}
</div>
<div class="userListItemButtons">
<img src="/assets/rassen/{{ user.getFactionId }}s.png" />
{{ userProfile(userId) }}
{{ pmWindow(USER, userId) }}
</div>
<div class="userBoxDetailAddendum">
<div>
<img title="Zuletzt online" src="/assets/buttons/time.png" />
{{ user.getLastAction|stuDateTime }}
</div>
<div>STATUS:
<span style="color: {{ listEntry.getUserStateColor }};">{{ listEntry.getUserStateDescription }}</span>
{% if user.isLocked %}
<a href="javascript:void(0)" onclick="showUserLock({{ userId }});"
onmouseover="cp('lock{{ userId }}','buttons/block1', 'png');"
onmouseout="cp('lock{{ userId }}','buttons/block2', 'png');"><img src="/assets/buttons/block2.png"
name="lock{{ userId }}" title="Spielersperre editieren" /></a>
<a href="/admin/?B_UNLOCK_USER=1&uid={{ userId }}&sstr={{ SESSIONSTRING }}"
onmouseover="cp('activate{{ userId }}','buttons/update1', 'png');"
onmouseout="cp('activate{{ userId }}','buttons/update0', 'png');"><img src="/assets/buttons/update0.png"
name="activate{{ userId }}" title="Spieler entsperren" /></a>
{% else %}
<a href="javascript:void(0)" onclick="showUserLock({{ userId }});"
onmouseover="cp('lock{{ userId }}','buttons/block1', 'png');"
onmouseout="cp('lock{{ userId }}','buttons/block2', 'png');"><img src="/assets/buttons/block2.png"
name="lock{{ userId }}" title="Spielersperre setzen" /></a>
{% endif %}
<a href="/admin/?B_BLOCK_USER=1&uid={{ userId }}&sstr={{ SESSIONSTRING }}"><img
src="/assets/buttons/selfdes2.png" name="block{{ userId }}" title="Spieler blockieren" /></a>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}
Loading

0 comments on commit c6b44fe

Please sign in to comment.