Updated 007 Admin Views (markdown)

Amigo 2019-07-15 15:34:50 +02:00
parent df0baaf4ce
commit 01b30786e2

@ -147,7 +147,9 @@ When we looked at the way that we are building the JavaScript, you'd remember th
### Adding AJAX Via the Controller and Method Implementation
There is a php area where you have the option of adding JavaScript to your editing view primarily. [01:01:55](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m55s) Looking at editing views, the moment you click on 'Add JavaScript,' it opens a tab. The way that we want to implement AJAX is via the controller and method implementation. The component has a controller called ajax.json.php which has a model called ajax. So you have a controller and a model. The controller is like the gatekeeper. It does a few checks and balances to ensure that the data is correct and the token is right. If you had set this to validate whether he is a user or not, it also checks for a user ID. [01:02:59](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h02m59s) If you set it that not to require him to be a user, it would drop off this validation.
[01:01:48](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h01m48s)
There is a php area where you have the option of adding JavaScript to your editing view primarily. Looking at editing views, the moment you click on 'Add JavaScript,' it opens a tab. The way that we want to implement AJAX is via the controller and method implementation. The component has a controller called ajax.json.php which has a model called ajax. So you have a controller and a model. The controller is like the gatekeeper. It does a few checks and balances to ensure that the data is correct and the token is right. If you had set this to validate whether he is a user or not, it also checks for a user ID. [01:02:59](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h02m59s) If you set it that not to require him to be a user, it would drop off this validation.
There is a controller area and a model area. The model is a place where you can write a method which is queried from the controller. You can see in the controller that it gets the Ajax model, and then queries a method in that model called Dropbox. Here we are querying the Dropbox method; it's getting the view name. [01:04:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h04m03s) I'm activating this method to run, and when it runs it triggers some global methods to run. On the return of that value it triggers another local method. So you can see that this part of the code was custom written. If we go back to our component you'd see that code there.