diff --git a/.gitignore b/.gitignore index 7a1537ba..0ba7aef1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -node_modules +node_modules/ +.DS_Store diff --git a/README.md b/README.md old mode 100644 new mode 100755 index ba20ee01..b48916f1 --- a/README.md +++ b/README.md @@ -1,52 +1,56 @@ -# PHP BASIC APPLICATION TO MANAGE AN EMPLOYEES LIST -## Application main points - -1. Login and logout with a json file as user storage -2. Controlled user session set to 10 minutes -3. Show data from a JSON in a JS Grid -4. Pagination of the data configured by the grid -5. Employees CRUD Create Read Delete and Update with a json file as employees storage -6. Employee page with employee detail -7. External web service to get employees images -8. Employee avatar through web service images - -### File structure - -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!! - -``` -assets/ -resources/ -src/ +# PHP BASIC APPLICATION TO MANAGE AN EMPLOYEES LIST + + +## Application main points + +1. Login and logout with a json file as user storage +2. Controlled user session set to 10 minutes +3. Show data from a JSON in a JS Grid +4. Pagination of the data configured by the grid +5. Employees CRUD Create Read Delete and Update with a json file as employees storage +6. Employee page with employee detail +7. External web service to get employees images +8. Employee avatar through web service images + + +### File structure +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!! + +```` +assets/ +css/ +resources/ +src/ /library -``` - -- Assets contains html, css, js & images -- Css just css files. -- Resources folder contains users.json and employees.json -- Src folder contains PHP files which contain HTML or JS -- Src/library folder contains PHP files that contain just PHP - -**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.** - -We use some naming conventions when create code files. For instance a file which handles HTTP request we name it as `Controller`. - -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. +```` + +* Assets contains images and plain HTML files. +* Css just css files. +* Resources folder contains users.json and employees.json +* Src folder contains PHP files which contain HTML or JS +* Src/library folder contains PHP files that contain just PHP + +**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.** + +We use some naming conventions when create code files. For instance a file which handles HTTP request we name it as `Controller`. + +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. 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!!** -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. +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. -``` + +``` index.php // which is the entry point of the application. The login view -employeeController.php // file which has JUST the php code to handle employees request +employeeController.php // file which has JUST the php code to handle employees request employeeManager.php // In this file we left you a list of named mehtods to implement and use. -loginController.php // here you need to handle all HTTP request of login things -loginManager.php // same thing here you need to write things as login validation logout etc.. +loginController.php // here you need to handle all HTTP request of login things +loginManager.php // same thing here you need to write things as login validation logout etc.. -sessionHelper.php // here you can add the code to check if the user session has expired. +sessionHelper.php // here you can add the code to check if the user session has expired. ``` 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. @@ -56,208 +60,206 @@ The sessionHelper file need to be added to each page we visit in order to check 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. So for instance a dashboard.php page can look like this at the beginning of the file: - ``` - -
- + + + + + + + + +