Updated 024 How to integrate the Create User Helper Method in your Components (markdown)

Amigo 2019-07-01 08:37:27 +02:00
parent b6211018f4
commit 6cfae19607
1 changed files with 4 additions and 3 deletions

@ -32,12 +32,13 @@ If this closed, open a 'New client'. The same values can be seen. [00:08:44](htt
Return to the Expert view.
Within every component that makes use of Ajax, a model, and a controller is created. The controller is named 'Ajax.json.php' and the model is named 'Ajax'. [00:10:04](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m04s) Open the model and the controller. As may be seen the controller gives the register commands within the construct method and adds the tasks to a switch, and makes a attempt to run the task. [00:10:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) In the model it gets the model Ajax, and then runs the method that corresponds to the task. <<<<<<<<<<<<<<<<<<<<<<<
Within every component that makes use of Ajax, a model, and a controller is created. The controller is named 'Ajax.json.php' and the model is named 'Ajax'. [00:10:04](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m04s) Open the model and the controller. As may be seen the controller gives the register commands within the construct method and adds the tasks to a switch, and makes an attempt to run the task. [00:10:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m31s) In the model it gets the model Ajax, and then runs the method that corresponds to the task.
It uses the Joomla's default filtering method in a way that it gets values that has been posted and validates if those values are actually there. The values are then transfered to the model. [00:11:05](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m05s) That is looking at it from a code perspective. Various methods are displayed in the model and some of them are protected, and some of them are public. Those 'getcreateuserfields' are usually the ones that gets called from the controller once the Ajax gets the verification level and it is verified. Here is the 'createUser' class. [00:11:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m31s) First check whether this user, (it is custom script, Component Builder does not write this) so then in returning to the user interface(Editing the Admin view) and scroll down to 'Create user fields, then there is 'Create user'. What has been written here, gets placed into the model. [00:12:07](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) That is the Ajax method. In the Ajax input specific tasks are notated, the task name, and specific variables, and again the method name. Method Names may be different from the Task Names. Select what should be validated(In the 'Select a Filter' area), whether it should be a integer, float etc. and if there's no value(In the 'Default' area), get the default value. This is where the controllers information is set up. [00:12:39](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m39s) Here may the custom script be done.<<<<<<<<<<<<<<<<<<
It uses the Joomla's default filtering method in the way that it gets values that are being posted. And then value dates that those values actually are there. Then sends the values over to the model. [00:11:05](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m05s) Now that's looking at it from a code side. If you look at the model it simply shows you various methods. Some of them are protected, and some of them are public. Those(getcreateuserfields) are usually the ones that gets called from the controller once the Ajax gets the verification level and it's verified. Here is the createuser class. [00:11:31](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m31s) We first check whether this user, (now this is custom script I mean this I wrote custom, component build does not write this) so basically when you go back to the user interface, you will see that if I scroll down here, create user fields, then there's create user. You see that I wrote this right here, and that basically gets placed into the model. [00:12:07](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) So that's the Ajax method. In that Ajax input I annotate the specific tasks, the task name, and specific variables, and again the method name. You could have different method names from task names. What should be validated, whether it's integer, float or whatever. And if there's no value, what is the value by default. So this is where you set up there basically the controllers information. [00:12:39](https://www.youtube.com/watch?v=ckFakaQ90JY&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m39s) And then here your customisely write your script. So basically create user gets data and seems from what view is it, then validates with this current login user has the permission to the experts area. Then it converts the data because it's a json set of datasets that I'm sending across. Checks whether it's an array, does some other checks.
So basically create user gets data and seems from what view is it, then validates with this current login user has the permission to the experts area. Then it converts the data because it's a json set of datasets that I'm sending across. Checks whether it's an array, does some other checks.
### Global Helper Class