Overview
Comment:List all but hidden, all including hidden, in users list
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA3-256: cae0f03d0542ba9d36a954d614954b12741f01daeec80db638a260915306a953
User & Date: bohwaz on 2022-12-17 14:47:51
Other Links: branch diff | manifest | tags
Context
2022-12-17
16:05
Add new text icon check-in: 453ace47b5 user: bohwaz tags: dev
14:47
List all but hidden, all including hidden, in users list check-in: cae0f03d05 user: bohwaz tags: dev
2022-12-16
02:31
Add database + backups size on config page check-in: f316864a36 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Users/Users.php from [5e6c31ae03] to [7bbdca6b68].

127
128
129
130
131
132
133


134







135
136
137
138
139
140
141

			$columns[$key] = [
				'label' => $config->label,
			];
		}

		$tables = User::TABLE;


		$conditions = $id_category ? sprintf('id_category = %d', $id_category) : sprintf('id_category IN (SELECT id FROM users_categories WHERE hidden = 0)');








		$order = 'identity';

		if (!isset($columns[$order])) {
			$order = key($fields) ?? 'number';
		}








>
>
|
>
>
>
>
>
>
>







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

			$columns[$key] = [
				'label' => $config->label,
			];
		}

		$tables = User::TABLE;

		if (!$id_category) {
			$conditions = sprintf('id_category IN (SELECT id FROM users_categories WHERE hidden = 0)');
		}
		elseif ($id_category > 0) {
			$conditions = sprintf('id_category = %d', $id_category);
		}
		else {
			$conditions = '1';
		}

		$order = 'identity';

		if (!isset($columns[$order])) {
			$order = key($fields) ?? 'number';
		}

Modified src/templates/docs/index.tpl from [aa3cfc2433] to [79ac045529].

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
					<td class="file-icon">{icon shape="folder"}</td>
					<th><a href="?path={$file.path}">{$file.name}</a></th>
					<td></td>
					<td></td>
					<td class="actions">
					{if $parent->canCreateHere() || $file->canDelete()}
						{linkmenu label="Modifier…" shape="edit"}
							{if $parent->canRename()}
								{linkbutton href="!common/files/rename.php?p=%s"|args:$file.path label="Renommer" shape="minus" target="_dialog"}
							{/if}
							{if $file->canDelete()}
								{linkbutton href="!common/files/delete.php?p=%s"|args:$file.path label="Supprimer" shape="delete" target="_dialog"}
							{/if}
						{/linkmenu}
					{/if}







|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
					<td class="file-icon">{icon shape="folder"}</td>
					<th><a href="?path={$file.path}">{$file.name}</a></th>
					<td></td>
					<td></td>
					<td class="actions">
					{if $parent->canCreateHere() || $file->canDelete()}
						{linkmenu label="Modifier…" shape="edit"}
							{if $file->canRename()}
								{linkbutton href="!common/files/rename.php?p=%s"|args:$file.path label="Renommer" shape="minus" target="_dialog"}
							{/if}
							{if $file->canDelete()}
								{linkbutton href="!common/files/delete.php?p=%s"|args:$file.path label="Supprimer" shape="delete" target="_dialog"}
							{/if}
						{/linkmenu}
					{/if}

Modified src/templates/users/index.tpl from [f59d7e61d1] to [f90fffa22e].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
	<p class="block confirm">Le membre a été supprimé.</p>
{/if}

{if !empty($categories)}
<form method="get" action="{$self_url}" class="shortFormRight">
	<fieldset>
		<legend>Filtrer par catégorie</legend>
		<select name="cat" id="f_cat" onchange="this.form.submit();">
			<option value="0" {if $current_cat == 0} selected="selected"{/if}>-- Toutes</option>
		{foreach from=$categories key="id" item="name"}
			{if $session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)
				|| !array_key_exists($id, $hidden_categories)}
			<option value="{$id}"{if $current_cat == $id} selected="selected"{/if}>{$name}</option>
			{/if}
		{/foreach}
		</select>
		<noscript><input type="submit" value="Filtrer &rarr;" /></noscript>
	</fieldset>
</form>
{/if}

<form method="get" action="search.php" class="shortFormLeft">
	<fieldset>
		<legend>Rechercher un membre</legend>
		<input type="text" name="qt" value="" />
		<input type="submit" value="Chercher &rarr;" />
	</fieldset>
</form>

<form method="post" action="action.php" class="memberList">

{if $list->count()}
	{pagination url=$list->paginationURL() page=$list.page bypage=$list.per_page total=$list->count()}







|
<
<
<
<
<
<
<
<
|




|


|
|







10
11
12
13
14
15
16
17








18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
	<p class="block confirm">Le membre a été supprimé.</p>
{/if}

{if !empty($categories)}
<form method="get" action="{$self_url}" class="shortFormRight">
	<fieldset>
		<legend>Filtrer par catégorie</legend>
		{input type="select" name="cat" onchange="this.form.submit();" options=$categories}








		<noscript>{button type="submit" name="" label="Filtrer" shape="right"}</noscript>
	</fieldset>
</form>
{/if}

<form method="get" action="search.php" class="shortFormLeft" data-focus="1">
	<fieldset>
		<legend>Rechercher un membre</legend>
		<input type="text" name="qt" value="" placeholder="Nom, numéro, ou adresse e-mail" />
		{button type="submit" name="" label="Chercher" shape="search"}
	</fieldset>
</form>

<form method="post" action="action.php" class="memberList">

{if $list->count()}
	{pagination url=$list->paginationURL() page=$list.page bypage=$list.per_page total=$list->count()}

Modified src/www/admin/users/index.php from [7b2fb4b43a] to [20c7151d41].

1
2
3
4
5
6
7
8

9

10



11
12



13

14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
namespace Garradin;

use Garradin\Users\Categories;
use Garradin\Users\Users;

require_once __DIR__ . '/_inc.php';


$categories = Categories::listSimple();

$hidden_categories = Categories::listHidden();




$current_cat = (int) qg('cat') ?: null;





// Deny access to hidden categories to users that are not admins
if ($current_cat && !$session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN) && array_key_exists($current_cat, $hidden_categories)) {
	$current_cat = null;
}

$can_edit = $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN);

$list = Users::listByCategory($current_cat);
$list->loadFromQueryString();

$tpl->assign(compact('can_edit', 'list', 'current_cat', 'hidden_categories', 'categories'));

$tpl->display('users/index.tpl');








>
|
>
|
>
>
>
|
<
>
>
>
|
>

|








|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Garradin;

use Garradin\Users\Categories;
use Garradin\Users\Users;

require_once __DIR__ . '/_inc.php';

$current_cat = (int) qg('cat') ?: null;

$categories = [0 => '— Toutes (sauf cachées) —'];

// Remove hidden categories
if (!$session->canAccess($session::SECTION_USERS, $session::ACCESS_WRITE)) {
	$categories = array_merge($categories, Categories::listNotHidden());
}

else {
	$categories[-1] = '— Toutes (même cachées) —';
	$categories = array_merge($categories, Categories::listSimple());
}

// Deny access to hidden categories to users that are not admins
if (!array_key_exists($current_cat, $categories)) {
	$current_cat = null;
}

$can_edit = $session->canAccess($session::SECTION_USERS, $session::ACCESS_ADMIN);

$list = Users::listByCategory($current_cat);
$list->loadFromQueryString();

$tpl->assign(compact('can_edit', 'list', 'current_cat', 'categories'));

$tpl->display('users/index.tpl');