old tickets

Issue 38: Add tab for inactive users in forge management
Issue 37: Add tab for active users in forge management
This commit is contained in:
Nathan Adams 2015-08-30 20:24:03 -05:00
parent 5c61ef6d52
commit 90ce6fda4c
3 changed files with 27 additions and 7 deletions

View File

@ -344,17 +344,21 @@ class IDF_Views_Admin
* *
*/ */
public $users_precond = array('Pluf_Precondition::staffRequired'); public $users_precond = array('Pluf_Precondition::staffRequired');
public function users($request, $match, $not_validated=false) public function users($request, $match, $pageType=null)
{ {
$pag = new Pluf_Paginator(new Pluf_User()); $pag = new Pluf_Paginator(new Pluf_User());
$db =& Pluf::db(); $db =& Pluf::db();
$true = Pluf_DB_BooleanToDb(true, $db); $true = Pluf_DB_BooleanToDb(true, $db);
if ($not_validated) { if ($pageType === 0) {
$pag->forced_where = new Pluf_SQL('first_name = \'---\' AND active!='.$true); $pag->forced_where = new Pluf_SQL('first_name = \'---\' AND active!='.$true);
$title = __('Not Validated User List'); $title = __('Not Validated User List');
$pag->action = 'IDF_Views_Admin::usersNotValidated'; $pag->action = 'IDF_Views_Admin::usersNotValidated';
} elseif ($pageType == 1) {
$pag->forced_where = new Pluf_SQL('first_name != \'---\' AND active!='.$true);
$title = __('Not Active User List');
$pag->action = 'IDF_Views_Admin::usersNotValidated';
} else { } else {
$pag->forced_where = new Pluf_SQL('first_name != \'---\''); $pag->forced_where = new Pluf_SQL('first_name != \'---\' AND active='.$true);
$title = __('User List'); $title = __('User List');
$pag->action = 'IDF_Views_Admin::users'; $pag->action = 'IDF_Views_Admin::users';
} }
@ -381,7 +385,6 @@ class IDF_Views_Admin
array( array(
'page_title' => $title, 'page_title' => $title,
'users' => $pag, 'users' => $pag,
'not_validated' => $not_validated,
), ),
$request); $request);
} }
@ -392,7 +395,16 @@ class IDF_Views_Admin
public $usersNotValidated_precond = array('Pluf_Precondition::staffRequired'); public $usersNotValidated_precond = array('Pluf_Precondition::staffRequired');
public function usersNotValidated($request, $match) public function usersNotValidated($request, $match)
{ {
return $this->users($request, $match, true); return $this->users($request, $match, 0);
}
/**
* Not validated users.
*/
public $usersInActive_precond = array('Pluf_Precondition::staffRequired');
public function usersInActive($request, $match)
{
return $this->users($request, $match, 1);
} }
/** /**

View File

@ -556,6 +556,11 @@ $ctl[] = array('regex' => '#^/admin/users/notvalid/$#',
'model' => 'IDF_Views_Admin', 'model' => 'IDF_Views_Admin',
'method' => 'usersNotValidated'); 'method' => 'usersNotValidated');
$ctl[] = array('regex' => '#^/admin/users/inactive/$#',
'base' => $base,
'model' => 'IDF_Views_Admin',
'method' => 'usersInActive');
$ctl[] = array('regex' => '#^/admin/users/(\d+)/$#', $ctl[] = array('regex' => '#^/admin/users/(\d+)/$#',
'base' => $base, 'base' => $base,
'model' => 'IDF_Views_Admin', 'model' => 'IDF_Views_Admin',

View File

@ -7,9 +7,12 @@
{/block} {/block}
{block context} {block context}
<p>{trans 'Number of users:'} <strong>{$users.nb_items}</strong></p> <p>{trans 'Number of users:'} <strong>{$users.nb_items}</strong></p>
{if !$not_validated}{aurl 'url', 'IDF_Views_Admin::usersNotValidated'} {aurl 'url', 'IDF_Views_Admin::usersNotValidated'}
<p class="helptext">{blocktrans}See <a href="{$url}">not validated users</a>.{/blocktrans}</p> <p class="helptext">{blocktrans}See <a href="{$url}">not validated users</a>.{/blocktrans}</p>
{/if} {aurl 'url', 'IDF_Views_Admin::usersInActive'}
<p class="helptext">See <a href="{$url}">inactive users</a>.</p><br>
{aurl 'url', 'IDF_Views_Admin::users'}
<p class="helptext">See <a href="{$url}">active users</a>.</p>
<div class="issue-submit-info"> <div class="issue-submit-info">
{blocktrans}<p>You have here an overview of the users registered in the forge.</p>{/blocktrans} {blocktrans}<p>You have here an overview of the users registered in the forge.</p>{/blocktrans}
</div> </div>