diff --git a/lib/Alchemy/Phrasea/Helper/User/Manage.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php index bf04fc72f9..755e1a1dc5 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Manage.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -55,6 +55,7 @@ class Manage extends Helper , 'like_value' => $request->get('like_value') , 'sbas_id' => $request->get('sbas_id') , 'base_id' => $request->get('base_id') + , 'last_model' => $this->request->get('last_model') , 'srt' => $request->get("srt", \User_Query::SORT_CREATIONDATE) , 'ord' => $request->get("ord", \User_Query::ORD_DESC) , 'offset_start' => 0 @@ -69,6 +70,7 @@ class Manage extends Helper $this->results = $query->sort_by($this->query_parms["srt"], $this->query_parms["ord"]) ->like($this->query_parms['like_field'], $this->query_parms['like_value']) + ->last_model_is($this->query_parms['last_model']) ->get_inactives($this->query_parms['inactives']) ->include_templates(false) ->on_bases_where_i_am($this->app['authentication']->getUser()->ACL(), array('canadmin')) @@ -92,6 +94,7 @@ class Manage extends Helper , 'like_value' => $this->request->get('like_value') , 'sbas_id' => $this->request->get('sbas_id') , 'base_id' => $this->request->get('base_id') + , 'last_model' => $this->request->get('last_model') , 'srt' => $this->request->get("srt", \User_Query::SORT_CREATIONDATE) , 'ord' => $this->request->get("ord", \User_Query::ORD_DESC) , 'per_page' => $results_quantity @@ -107,6 +110,7 @@ class Manage extends Helper $this->results = $query->sort_by($this->query_parms["srt"], $this->query_parms["ord"]) ->like($this->query_parms['like_field'], $this->query_parms['like_value']) + ->last_model_is($this->query_parms['last_model']) ->get_inactives($this->query_parms['inactives']) ->include_templates(true) ->on_bases_where_i_am($this->app['authentication']->getUser()->ACL(), array('canadmin')) diff --git a/lib/classes/User/Query.php b/lib/classes/User/Query.php index fb5c01cdae..ad10d3c752 100644 --- a/lib/classes/User/Query.php +++ b/lib/classes/User/Query.php @@ -139,6 +139,7 @@ class User_Query implements User_QueryInterface * @var int */ protected $offset_start; + protected $last_model; /** * @@ -228,7 +229,7 @@ class User_Query implements User_QueryInterface $sql .= ' AND usr.invite=0 '; } - if (! $this->email_not_null) { + if ($this->email_not_null) { $sql .= ' AND usr.usr_mail IS NOT NULL '; } @@ -321,6 +322,10 @@ class User_Query implements User_QueryInterface } } + if ($this->last_model) { + $sql .= ' AND usr.lastModel = "' . mysql_real_escape_string($this->last_model) . '" '; + } + $sql_like = array(); foreach ($this->like_field as $like_field => $like_value) { @@ -397,6 +402,13 @@ class User_Query implements User_QueryInterface return $this; } + public function last_model_is($login = null) + { + $this->last_model = $login instanceof \User_Adapter ? $login->get_login() : $login; + + return $this; + } + public function include_phantoms($boolean = true) { $this->include_phantoms = ! ! $boolean; diff --git a/templates/web/admin/users.html.twig b/templates/web/admin/users.html.twig index 8405fe72d9..d31da60946 100644 --- a/templates/web/admin/users.html.twig +++ b/templates/web/admin/users.html.twig @@ -37,10 +37,16 @@ - {% trans 'Push::filter starts' %} + {% trans 'Last applied template' %} +
@@ -161,6 +167,7 @@ {% endif %} +