mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Add user OK. Tabla de user modificada para mostrar todos los grupos
This commit is contained in:
@ -56,24 +56,27 @@ class Ajax extends ResourceController
|
||||
|
||||
//Total number of records without filtering
|
||||
$totalRecords = $this->user_model->select('id_user')
|
||||
->join('auth_user_group','auth_user_group.token = auth_user.group')
|
||||
//->join('auth_user_group','auth_user_group.token = auth_user.group')
|
||||
->countAllResults();
|
||||
|
||||
//Total number of records with filtering
|
||||
$totalRecordwithFilter = $this->user_model->select('id_user')
|
||||
->join('auth_user_group','auth_user_group.token = auth_user.group')
|
||||
//->join('auth_user_group','auth_user_group.token = auth_user.group')
|
||||
->orLike('first_name', $searchValue)
|
||||
->orLike('email', $searchValue)
|
||||
->countAllResults();
|
||||
|
||||
//Fetch records
|
||||
$records = $this->user_model->select('auth_user.*,auth_user_group.title')
|
||||
->join('auth_user_group','auth_user_group.token = auth_user.group')
|
||||
//$records = $this->user_model->select('auth_user.*,auth_user_group.title')
|
||||
$records = $this->user_model->select('auth_user.*')
|
||||
//->join('auth_user_group','auth_user_group.token = auth_user.group')
|
||||
->orLike('first_name', $searchValue)
|
||||
->orLike('email', $searchValue)
|
||||
->orderBy($columnName,$columnSortOrder)
|
||||
->findAll($rowperpage, $start);
|
||||
|
||||
|
||||
|
||||
//Format records
|
||||
foreach ($records as $key => $value){
|
||||
if($records[$key]['email_confirmed'] == 1){
|
||||
@ -96,10 +99,26 @@ class Ajax extends ResourceController
|
||||
//Data records
|
||||
$data = array();
|
||||
foreach($records as $record ){
|
||||
|
||||
$groups_token = $this->group_user_model->select('token_group')
|
||||
->where('token_user',$record['token'])
|
||||
->findAll();
|
||||
|
||||
$groups_names = [];
|
||||
foreach($groups_token as $g_t){
|
||||
$title = $this->group_model->select('title')
|
||||
->where('token',$g_t)
|
||||
->first()['title'];
|
||||
array_push($groups_names, $title);
|
||||
|
||||
}
|
||||
|
||||
$data[] = array(
|
||||
"first_name"=>$record['first_name'],
|
||||
"email"=>$record['email'],
|
||||
"group"=>$record['title'],
|
||||
|
||||
"group"=>$groups_names,//JJO$record['title'],
|
||||
|
||||
"mobile"=>$record['mobile'],
|
||||
"last_access"=>$record['last_access'],
|
||||
"last_ip"=>$record['last_ip'],
|
||||
|
||||
Reference in New Issue
Block a user