├── .gitignore ├── README.md ├── assets ├── css │ ├── contact.css │ ├── dashboardStyle.css │ ├── employeeStyle.css │ ├── loginStyle.css │ ├── main.css │ └── normalize.css ├── html │ ├── footer.html │ └── header.html ├── img │ ├── asse.webp │ ├── b.png │ ├── c.png │ ├── v_50.png │ └── worker.gif └── js │ ├── contactScript.js │ ├── faceApi.js │ └── index.js ├── contact.php ├── index.php ├── package-lock.json ├── package.json ├── resources ├── employees.json ├── images_mock.json └── users.json └── src ├── dashboard.php ├── employee.php ├── imageGallery.php └── library ├── avatarsApi.php ├── employeeController.php ├── employeeManager.php ├── loginController.php ├── loginManager.php ├── logout.php ├── registerEmployee.php └── sessionHelper.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | node_modules 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP BASIC APPLICATION TO MANAGE AN EMPLOYEES LIST 2 | 3 | ## Application main points 4 | 5 | 1. Login and logout with a json file as user storage 6 | 2. Controlled user session set to 10 minutes 7 | 3. Show data from a JSON in a JS Grid 8 | 4. Pagination of the data configured by the grid 9 | 5. Employees CRUD Create Read Delete and Update with a json file as employees storage 10 | 6. Employee page with employee detail 11 | 7. External web service to get employees images 12 | 8. Employee avatar through web service images 13 | 14 | ### File structure 15 | 16 | This file structure has a specific purpose. So you have to implement all the required over it. Later when we get to OPP and MySQL we will refactor the project to get it more sophisticated, modern and cleaner. Please take care of it!! 17 | 18 | ``` 19 | assets/ 20 | resources/ 21 | src/ 22 | /library 23 | ``` 24 | 25 | - Assets contains html, css, js & images 26 | - Css just css files. 27 | - Resources folder contains users.json and employees.json 28 | - Src folder contains PHP files which contain HTML or JS 29 | - Src/library folder contains PHP files that contain just PHP 30 | 31 | **We left to you the project files in their folders to give you a structure which we want you to work with in order to later refactor it.** 32 | 33 | We use some naming conventions when create code files. For instance a file which handles HTTP request we name it as `Controller`. 34 | 35 | In the other hand we have also the concept of `Manager` which typically implements an abstraction layer over a storage system, in this case as we are going to work with json files for a while (bear on mind later we refactor it to MySQL and then we will also have a `Model` file) we would need to create on it all functions we need to access the json file. 36 | 37 | A file called `Model` implements a database layer is a file which interacts directly with a Database. **On future projects we will refactor this project to add Models and much more!!** 38 | 39 | We also added the concept of `Helper` which is a class which its finality is to help `Controllers` and `Managers` to be lighter and to keep single responsibility. 40 | 41 | ``` 42 | index.php // which is the entry point of the application. The login view 43 | employeeController.php // file which has JUST the php code to handle employees request 44 | employeeManager.php // In this file we left you a list of named mehtods to implement and use. 45 | 46 | loginController.php // here you need to handle all HTTP request of login things 47 | loginManager.php // same thing here you need to write things as login validation logout etc.. 48 | 49 | sessionHelper.php // here you can add the code to check if the user session has expired. 50 | ``` 51 | 52 | The sessionHelper file need to be added to each page we visit in order to check if the user session has expired and if so to call the methods of the loginManager to logout the admin user. 53 | 54 | ### Including or importing code files to current file 55 | 56 | As you have seen in JS there are sentences to import code from other files to the current file we are working. In PHP happens the same thing. And as we want to encapsulate code by concepts( the login page request are managed by a loginController and so on) it is required to import files. 57 | 58 | So for instance a dashboard.php page can look like this at the beginning of the file: 59 | 60 | ``` 61 | 66 |
67 | 68 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |If you have questions or any problems with our program, please contact us, we will attend to you as soon as 40 | possible. Dev Team .
41 | 42 | 52 | 57 | 58 | 59 |