diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 7ad8bd97be..69e63c432c 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -230,6 +230,18 @@ public function autoLayout($enable = null) return $this->autoLayout; } + /** + * Return the current called action + * + * NOTE: this information is available after Controller initialization. + * + * @return string + */ + public function getAction() + { + return $this->action; + } + /** * Return the current Theme. * diff --git a/app/Middleware/VerifyCsrfToken.php b/app/Middleware/VerifyCsrfToken.php index 40ec398d52..e92cbef8cd 100644 --- a/app/Middleware/VerifyCsrfToken.php +++ b/app/Middleware/VerifyCsrfToken.php @@ -14,5 +14,6 @@ class VerifyCsrfToken extends BaseVerifier */ protected $except = array( 'admin/files/connector', + 'livechat/*', ); } diff --git a/app/Platform/Bootstrap.php b/app/Platform/Bootstrap.php index 64089e223a..d947121367 100644 --- a/app/Platform/Bootstrap.php +++ b/app/Platform/Bootstrap.php @@ -14,7 +14,7 @@ // Define The Application Version //-------------------------------------------------------------------------- -define('VERSION', '4.0.79'); +define('VERSION', '4.0.80'); //-------------------------------------------------------------------------- // Set PHP Error Reporting Options diff --git a/modules/Platform/Notifications/AccountActivation.php b/modules/Platform/Notifications/AccountActivation.php index 567fc76011..82ade4476f 100644 --- a/modules/Platform/Notifications/AccountActivation.php +++ b/modules/Platform/Notifications/AccountActivation.php @@ -6,7 +6,7 @@ use Nova\Notifications\Notification; use Nova\Notifications\Messages\MailMessage; use Nova\Queue\ShouldQueueInterface; -use Nova\Support\Facades\Config +use Nova\Support\Facades\Config; class AccountActivation extends Notification implements ShouldQueueInterface diff --git a/modules/Roles/Views/Admin/Roles/Index.php b/modules/Roles/Views/Admin/Roles/Index.php index 09711c6f7e..c44f058a4c 100644 --- a/modules/Roles/Views/Admin/Roles/Index.php +++ b/modules/Roles/Views/Admin/Roles/Index.php @@ -25,7 +25,7 @@
-
+

links(); ?> diff --git a/modules/Users/Controllers/Admin/Users.php b/modules/Users/Controllers/Admin/Users.php index e25c42ad25..aee64a8257 100644 --- a/modules/Users/Controllers/Admin/Users.php +++ b/modules/Users/Controllers/Admin/Users.php @@ -17,12 +17,17 @@ use Nova\Support\Facades\Gate; use Nova\Support\Facades\Hash; use Nova\Support\Facades\Input; +use Nova\Support\Facades\Language; use Nova\Support\Facades\File; use Nova\Support\Facades\Redirect; +use Nova\Support\Facades\Response; use Nova\Support\Facades\Validator; +use Nova\Support\Facades\View; use Nova\Support\Arr; use Nova\Support\Str; +use Shared\Support\DataTable; + use Modules\Platform\Controllers\Admin\BaseController; use Modules\Roles\Models\Role; use Modules\Users\Models\Field; @@ -142,6 +147,41 @@ protected function validator(array $data, Collection $items, $id = null) return $validator; } + public function data(Request $request) + { + $columns = array( + array('data' => 'id', 'name' => 'id'), + array('data' => 'username', 'name' => 'username'), + array('data' => 'realname', 'name' => 'realname'), + array('data' => 'email', 'name' => 'email'), + + array('data' => 'roles', 'name' => 'roles.name', 'uses' => function ($user) + { + $roles = $user->roles->lists('name'); + + return implode(', ', $roles); + }), + + array('data' => 'created_at', 'name' => 'created_at', 'uses' => function ($user) + { + $format = __d('users', '%d %b %Y, %H:%M'); + + return $user->created_at->formatLocalized($format); + }), + + array('data' => 'actions', 'name' => 'actions', 'uses' => function ($user) + { + return View::fetch('Modules/Users::Partials/UsersTableActions', compact('user')); + }), + ); + + $query = User::with('roles')->where('activated', 1); + + $data = DataTable::handle($query, $request, $columns); + + return Response::json($data); + } + public function index() { // Authorize the current User. @@ -149,12 +189,11 @@ public function index() throw new AuthorizationException(); } - // Get all User records for current page. - $users = User::where('activated', 1)->paginate(25); + $langInfo = Language::info(); return $this->createView() ->shares('title', __d('users', 'Users')) - ->with('users', $users); + ->with('langInfo', $langInfo); } public function create(Request $request) diff --git a/modules/Users/Routes/Web.php b/modules/Users/Routes/Web.php index c8fb4ab429..e70e28f70c 100644 --- a/modules/Users/Routes/Web.php +++ b/modules/Users/Routes/Web.php @@ -27,9 +27,11 @@ // The Users Search. Route::get('users/search', 'Users@search'); - // The Users CRUD. - Route::paginate('users', 'Users@index'); + // Server Side Processor for Roles DataTable. + Route::post('users/data', 'Users@data'); + // The Users CRUD. + Route::get( 'users', 'Users@index'); Route::get( 'users/create', 'Users@create'); Route::post('users', 'Users@store'); Route::get( 'users/{id}', 'Users@show'); diff --git a/modules/Users/Views/Admin/Users/Index.php b/modules/Users/Views/Admin/Users/Index.php index 0cacb47a20..e570be8dc1 100644 --- a/modules/Users/Views/Admin/Users/Index.php +++ b/modules/Users/Views/Admin/Users/Index.php @@ -26,62 +26,71 @@
-
+

-
- links(); ?> -
- - isEmpty()) { ?> - - - - - - - - - - - items() as $user) { ?> - - - - - - - - - - +
id; ?>username; ?>roles->lists('name')); ?>realname; ?>email; ?>created_at->formatLocalized(__d('users', '%d %b %Y, %R')); ?> -
- - - - - - - - - - -
-
+ + + + + + + + + + + + +
- -
-

- -
-
- + + +