Skip to content

Commit

Permalink
Some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kozi committed Jul 14, 2015
1 parent 23c67a0 commit 01120d1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 30 deletions.
4 changes: 2 additions & 2 deletions contao/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
*/

ClassLoader::addClasses(array(
'ModuleUser2Group' => 'system/modules/user2group_viewer/modules/ModuleUser2Group.php'
'ModuleUser2Group' => 'system/modules/user2group/modules/ModuleUser2Group.php'
));

TemplateLoader::addFiles(array(
'be_user2group' => 'system/modules/user2group_viewer/templates',
'be_user2group' => 'system/modules/user2group/templates',
));

9 changes: 4 additions & 5 deletions contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
* @filesource
*/

array_insert($GLOBALS['BE_MOD']['accounts'], 4, array
(
'user2group_viewer' => array (
array_insert($GLOBALS['BE_MOD']['accounts'], 4, [
'user2group_viewer' => [
'callback' => 'ModuleUser2Group',
'icon' => 'system/themes/default/images/group.gif',
)
));
]
]);


2 changes: 1 addition & 1 deletion contao/languages/de/modules.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

$GLOBALS['TL_LANG']['MOD']['user2group_viewer'] = array('Gruppenübersicht', 'Welche Benutzer sind in den verschiedenen Gruppen');
$GLOBALS['TL_LANG']['MOD']['user2group_viewer'] = ['Gruppenübersicht', 'Welche Benutzer sind in den verschiedenen Gruppen'];
2 changes: 1 addition & 1 deletion contao/languages/en/modules.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

$GLOBALS['TL_LANG']['MOD']['user2group_viewer'] = array('Groups Overview', 'Overview for users and user groups');
$GLOBALS['TL_LANG']['MOD']['user2group_viewer'] = ['Groups Overview', 'Overview for users and user groups'];
10 changes: 5 additions & 5 deletions contao/modules/ModuleUser2Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ModuleUser2Group extends BackendModule {
protected function compile() {
$this->loadLanguageFile('tl_user');

$GLOBALS['TL_CSS'][] = 'system/modules/user2group_viewer/assets/user2group.css';
$GLOBALS['TL_CSS'][] = 'system/modules/user2group/assets/user2group.css';

$label['group'] = $GLOBALS['TL_LANG']['tl_user']['groups'][0];
$label['user'] = $GLOBALS['TL_LANG']['tl_user']['name'][0];
Expand All @@ -41,20 +41,20 @@ protected function compile() {
$label['no_groups'] = $GLOBALS['TL_LANG']['MSC']['user2group_no_groups'];


$arrGroupList = array();
$arrUserList = array();
$arrGroupList = [];
$arrUserList = [];


// Get groups
$objGroupCollection = \UserGroupModel::findAll(array('order' => 'name ASC'));
$objGroupCollection = \UserGroupModel::findAll(['order' => 'name ASC']);
if ($objGroupCollection !== null) {
foreach($objGroupCollection as $objGroup) {
$this->addGroup($objGroup);
}
}

// User
$objUserCollection = \UserModel::findAll(array('order' => 'name ASC'));
$objUserCollection = \UserModel::findAll(['order' => 'name ASC']);
if ($objUserCollection !== null) {
foreach($objUserCollection as $objUser) {
$this->addUser($objUser);
Expand Down
36 changes: 20 additions & 16 deletions contao/templates/be_user2group.html5
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<div id="user2group_viewer">
<h2><?php echo $this->label['title']; ?></h2>
<h2><?=$this->label['title']?></h2>

<h3><?php echo $this->label['group']; ?></h3>
<h3><?=$this->label['group']?></h3>
<?php if ($this->groupList): ?>
<ul class="groups">
<?php foreach ($this->groupList as $group): ?>
<li>
<table class="user">
<thead>
<tr>
<th colspan="3"><?php echo $group->name; ?></th>
<th colspan="3"><?=$group->name?></th>
</tr>
</thead>
<tbody>
<?php $i=0; foreach ($group->userList as $user): ?>
<tr class="<?php echo ($i++ %2 == 0) ? 'odd':'even' ; ?>">
<td class="name"><?php echo $user->name; ?></td>
<td class="username"><?php echo $user->username; ?></td>
<td class="email"><a href="mailto:<?php echo $user->email; ?>"><?php echo $user->email; ?></a></td>
<tr class="<?=(($i++ %2 == 0) ? 'odd':'even')?>">
<td class="name"><?=$user->name?></td>
<td class="username"><?=$user->username?></td>
<td class="email"><a href="mailto:<?=$user->email?>"><?=$user->email?></a></td>
</tr>
<?php endforeach; ?>
</tbody></table>
Expand All @@ -26,29 +26,33 @@
</ul>

<?php else: ?>
<p><?php echo $this->label['no_groups']; ?></p>
<p><?=$this->label['no_groups']?></p>
<?php endif; ?>

<h3>Benutzer</h3>
<table class="allUser">
<thead>
<tr>
<th><?php echo $this->label['user']; ?></th>
<th><?php echo $this->label['group']; ?></th>
<th><?=$this->label['user']?></th>
<th><?=$this->label['group']?></th>
</tr>
</thead>
<tbody>
<?php foreach ($this->userList as $user): ?>
<tr class="<?php echo ($i++ %2 == 0) ? 'odd':'even' ; ?>">
<tr class="<?=(($i++ %2 == 0) ? 'odd':'even')?>">
<td class="name">
<a href="mailto:<?php echo $user->email; ?>"><?php echo $user->name; ?></a>
<a href="mailto:<?=$user->email?>"><?=$user->name?></a>
</td>

<td class="groups">
<?php if($user->groupList): foreach ($user->groupList as $g):
echo '<span>'.$g->name.'</span> ';
endforeach; endif;
if ($user->admin) { echo '<span class="admin">'.$this->label['admin'].'</span>'; } ?>
<?php if($user->groupList):?>
<?php foreach ($user->groupList as $g):?>
<span><?=$g->name?></span>
<?php endforeach; ?>
<?php endif; ?>
<?php if($user->admin):?>
<span class="admin"><?=$this->label['admin']?></span>
<?php endif; ?>
</td>

</tr>
Expand Down

0 comments on commit 01120d1

Please sign in to comment.