Updated 007 Admin Views (markdown)

Amigo 2019-05-22 17:03:08 +02:00
parent b500bd0d42
commit bed95e040b

@ -97,10 +97,13 @@ There is save method and so if we go back here and we click on the save method,
The post save hook [01:14:05](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m05s) is actually in the controller not in the model. So You go to the controller sermon. Scroll to the bottom and you see there is a (postsavehook). It basically gives you the model and it gives you the valid data and you can actually can perform extra features on it. [01:14:27](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m27s) But in all these things you should just read the description. It says "PHP here that should run in the postSavehook Method and there is the (object)$model is the data model object and (array) validated data". So if you just read our little note here, then you can start coding for it. That is adding custom scripting to the view. [01:14:55](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m55s) Basically the list view as well as each view and then the MySQL dump area which we looked at earlier. The post save hook [01:14:05](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m05s) is actually in the controller not in the model. So You go to the controller sermon. Scroll to the bottom and you see there is a (postsavehook). It basically gives you the model and it gives you the valid data and you can actually can perform extra features on it. [01:14:27](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m27s) But in all these things you should just read the description. It says "PHP here that should run in the postSavehook Method and there is the (object)$model is the data model object and (array) validated data". So if you just read our little note here, then you can start coding for it. That is adding custom scripting to the view. [01:14:55](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h14m55s) Basically the list view as well as each view and then the MySQL dump area which we looked at earlier.
**Dump File** **MySQL Dumps Test Data**(insert into table)
You can do two kinds of dumps. What is this used mostly for? Well what I found while I was busy developing that I would be busy setting up a component [01:15:15](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m15s) and install it and then add dummy data to it to see if it works. And then every time I make a change and I uninstall that component and install the new one because whatever change it made to the database won't be added to the database via an update. You need to uninstall the component and install it again to get the database back to where you want it. And so the only way I could save myself [01:15:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m43s) time, is to actually say listen I'm going to re-install this component and the dummy data for sermons. I would like to retain. So I would go to table and I open the tables. It will show me a list of all the tables that are in the database at that moment. And then I would scroll to sermon table. Click on it [01:16:06](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m06s) and it will load the table and what it should be called in the data set. Here(Source Map) is some explanation if you want to do other tables. Let's say you want to have it mapped to multiple tables, then this(Source Map) is the explanation on how to do that. I would not recommend doing this because possibly you will not get [01:16:29](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m29s) what you expect. And just going with the values that he populates for you, will possibly your best call, unless those values change and if you are making changes adding new fields. You must realize that you need to come and reset this by clicking on something else. And then clicking on it again and that it loads the new [01:16:57](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) list of fields that are related to this table to this back end view table. And that way when you compile the component then component builder will actually grab the data from the database and build a dump file for you. You can do two kinds of dumps. What is this used mostly for? Well what I found while I was busy developing that I would be busy setting up a component [01:15:15](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m15s) and install it and then add dummy data to it to see if it works. And then every time I make a change and I uninstall that component and install the new one because whatever change it made to the database won't be added to the database via an update. You need to uninstall the component and install it again to get the database back to where you want it. And so the only way I could save myself [01:15:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h15m43s) time, is to actually say listen I'm going to re-install this component and the dummy data for sermons. I would like to retain. So I would go to table and I open the tables. It will show me a list of all the tables that are in the database at that moment. And then I would scroll to sermon table. Click on it [01:16:06](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m06s) and it will load the table and what it should be called in the data set. Here(Source Map) is some explanation if you want to do other tables. Let's say you want to have it mapped to multiple tables, then this(Source Map) is the explanation on how to do that. I would not recommend doing this because possibly you will not get [01:16:29](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m29s) what you expect. And just going with the values that he populates for you, will possibly your best call, unless those values change and if you are making changes adding new fields. You must realize that you need to come and reset this by clicking on something else. And then clicking on it again and that it loads the new [01:16:57](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h16m57s) list of fields that are related to this table to this back end view table. And that way when you compile the component then component builder will actually grab the data from the database and build a dump file for you.
**Dump File Itself** **Dump File Itself**
Now that is one way of doing it. [01:17:18](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m18s) It might be a little bit complex but it saved me tons of hours. The other way would be to just do a dump file itself. So you'd go to your MySQL, you would open the specific, let's use smaller field types. [01:17:40](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m40s) Click on export and then you would select SQL format and click 'go'. And this will create a dump file of all the data in the table. And you can basically paste that dump file in here. [01:18:17](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m17s) So you click 'export', click 'quick' then SQL and then 'Go'. And then save it. Then go to that file(cb componentbuilder_fieldtpye.sql) open it and having it open. [01:18:41](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m41s) You just replace this string(cd) with (#_). Click 'Replace All'. And you will not use the table structure because that is already in component builder. You just use [01:19:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m03s) this(selected in blue) area here. Basically you would copy this area(selected in blue) like that, cut, come here(MySQL) paste and click save. And that will mean that you have the dump file. And it will always be added [01:19:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m36s) to your new install. If a dump file is way too big, you will see it by just after your clicked save, come and look at the end and see if it cut it off somewhere. So let's say it cut it off there, then I would know my dumb file is to big for use. [01:20:04](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m04s) Let's just make sure, (componentbuilder.admin.view) (structure) For your dump file I used medium text. There it is 'sql'. I've used medium text. [01:20:39](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m39s) So that means It's quite big you can really put a lot of text inside of it. If you want to know exactly how much, just Google it, and you will see I'm going to remove this because It's not related to sermons at all. [01:20:57](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m57s) In fact I'm not even go to use the dump here, save and close. That is basically setting up an admin view. I know I've run around and it seemed quite hectic and I possibly will redo this video at a certain stage. Try to be structured but I think it is informative enough. [01:21:20](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m20s) If you have any questions please email me and I will try to communicate with you. If I see that a certain question comes up often enough I will add it to the Video possibly redoing this specific area. [01:21:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m35s) Admin views is quite intense and we will possibly revisit many of the concepts that we have looked at today. Now that is one way of doing it. [01:17:18](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m18s) It might be a little bit complex but it saved me tons of hours. The other way would be to just do a dump file itself. So you'd go to your MySQL, you would open the specific, let's use smaller field types. [01:17:40](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h17m40s) Click on export and then you would select SQL format and click 'go'. And this will create a dump file of all the data in the table. And you can basically paste that dump file in here. [01:18:17](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m17s) So you click 'export', click 'quick' then SQL and then 'Go'. And then save it. Then go to that file(cb componentbuilder_fieldtpye.sql) open it and having it open. [01:18:41](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h18m41s) You just replace this string(cd) with (#_). Click 'Replace All'. And you will not use the table structure because that is already in component builder. You just use [01:19:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m03s) this(selected in blue) area here. Basically you would copy this area(selected in blue) like that, cut, come here(MySQL) paste and click save. And that will mean that you have the dump file. And it will always be added [01:19:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h19m36s) to your new install. If a dump file is way too big, you will see it by just after your clicked save, come and look at the end and see if it cut it off somewhere. So let's say it cut it off there, then I would know my dumb file is to big for use. [01:20:04](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m04s) Let's just make sure, (componentbuilder.admin.view) (structure) For your dump file I used medium text. There it is 'sql'. I've used medium text. [01:20:39](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m39s) So that means It's quite big you can really put a lot of text inside of it. If you want to know exactly how much, just Google it, and you will see I'm going to remove this because It's not related to sermons at all. [01:20:57](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h20m57s) In fact I'm not even go to use the dump here, save and close.
That is basically setting up an admin view. I know I've run around and it seemed quite hectic and I possibly will redo this video at a certain stage. Try to be structured but I think it is informative enough. [01:21:20](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m20s) If you have any questions please email me and I will try to communicate with you. If I see that a certain question comes up often enough I will add it to the Video possibly redoing this specific area. [01:21:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=01h21m35s) Admin views is quite intense and we will possibly revisit many of the concepts that we have looked at today.