/** * Created by Pensare Software. * User: Theo Weijmer * Date: 25/12/2017 * Time: 09:50 */ dbo.userDataService = { getAllUsers: function ( archive = 'F', callback ) { $.getJSON( 'index.php/beheer/usersController/getAllUsers/' + archive ) .done( function ( data ) { callback( data ); } ); }, getUser: function ( userID, callback ) { $.getJSON( 'index.php/beheer/usersController/getUser/' + userID ) .done( function ( data ) { callback( data ); } ); }, getCurrentUser: function ( callback ) { $.getJSON( 'index.php/beheer/usersController/getCurrentUser' ) .done( function ( data ) { callback( data ); } ); }, getUserWithprojects: function ( callback ) { $.getJSON( 'index.php/beheer/usersController/getUserWithprojects' ) .done( function ( data ) { callback( data ); } ); }, getUserActiveProjects: function ( userID, callback ) { $.getJSON( 'index.php/beheer/usersController/getUserActiveProjects/' + userID ) .done( function ( data ) { callback( data ); } ); }, getUniqueProjectEmployees: function ( callback ) { $.post( 'index.php/beheer/usersController/getUniqueprojectEmployees', 'json' ) .done( function ( data ) { callback( data ); } ); }, getUniqueEmployeesWithActivity: function ( archive, callback ) { $.post( 'index.php/beheer/usersController/getUniqueEmployeesWithActivity/' + archive, 'json' ) .done( function ( data ) { callback( data ); } ); }, checkUsername: function ( username, callback ) { $.post( 'index.php/beheer/userController/checkUsername', 'json' ) .done( function ( data ) { console.log( data ); callback( data ); } ); }, saveUser: function ( submitDATA, callback ) { $.post( 'index.php/beheer/usersController/saveUser', submitDATA, function () { }, 'json' ) .done( function ( data ) { callback( data ); } ); }, savePassword: function ( password, callback ) { $.post( '/index.php/beheer/usersController/savePassword', {password: password} ) .done( function () { callback(); } ); }, archiveUser: function ( userID, status, callback ) { $.get( 'index.php/beheer/usersController/archiveUser/' + userID + '/' + status ) .done( function () { callback(); } ); }, removeUser: function ( userID, callback ) { $.getJSON( 'index.php/beheer/usersController/removeUser/' + userID ) .done( function ( data ) { callback( data ); } ); }, logOut : function(callback){ $.get('index.php/login/logout', function(){ callback(); }); } } dbo.userDataService.getCurrentUser(function(data){ dbo.currentUser = data; });