Updated 020 Adding Custom Admin Views to a Component (markdown)

Amigo 2019-06-22 12:18:47 +02:00
parent 5e6fe0302b
commit 823bd7e4b0
1 changed files with 5 additions and 5 deletions

@ -44,12 +44,12 @@ If you are uncertain you can undo everything and simply change it and compile a
NB. This 'order before' is only necessary when 'add' is selected to 'Main-menu' or to 'Sub-menu'. If that is used there will be a icon area displayed in the component(Cost Benefit Projection) and at the top will the menu items be shown.(Companies). Once it is opened the Sub-menu appears on the left.[00:07:34](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m34s) There is 'Main' menu and 'Dashboard (list of records)'. Now 'Dashboard (list of records)'need to be placed at the top of the components toolbar and then 'Submenu' at the left. [00:07:58](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m58s)
The Custom Admin View simply needs to be placed in the Sub-menu and is independent from any other dataset and then the Sub-menu method can be used. If you want a feature in the main menu, these are all the features that can be set. [00:08:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m25s) Whereas the 'Dashboard (list record)' feature helps to link it to a specific set of data structures. These IDs can be selected, and when you click on this combined results, the IDs of the selected items gets passed to the controller. For example: Look in 'Companies',in 'Components' ,in 'Component Builder' in 'Custom Admin Views' in 'Combined results' and then in 'Custom Buttons'. [00:08:54](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m54s) We're using the 'Main get' called 'Companies data' (getlistquery).<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
The Custom Admin View simply needs to be placed in the Sub-menu and is independent from any other dataset and then the Sub-menu method can be used. If you want a feature in the main menu, these are all the features that can be set. [00:08:25](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m25s) Whereas the 'Dashboard (list record)' feature helps to link it to a specific set of data structures. These IDs can be selected, and when you click on this combined results, the IDs of the selected items gets passed to the controller. For example: Look in 'Companies',in 'Components' ,in 'Component Builder' in 'Custom Admin Views' in 'Combined results' and then in 'Custom Buttons'. [00:08:54](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m54s) We're using the 'Main get' called 'Companies data' (getlistquery).
The implementation of those IDs can be seen in the Data query. Reach into the input object(PHP in Editing the Dynamic get). Get the 'cid', selected 'IDs', and saying 'tt' can be 'CMD'and then 'explode' 'cid', [00:09:35](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) Make sure it is 'intervals', and place it in 'ids'. This actually gets 'this' value from the 'post object', and places that into 'ids'.[00:09:59](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m59s) Validation needs to be done to ensure that the person who's trying to access the data has the right to do it. Once that is passed , those 'ids' is used to get the data.
[00:10:20](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m20s) In the filter '$ids' are used, and check whether all the 'ids' are in a 'id' and that in the code. Then look at the code, it's on the models 'Combine Results'. It uses the checking method. It checks the 'ids',(See video) puts it in an array and check if it's in an array then 'implodes' it. Checks whether it gets those ids. [00:10:45](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m45s) That's how the dataset is filtered with the results of the selection. That's just a glimpse in the back end at the use of those features.[00:11:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m07s) It is some custom scripting which were added to the Dynamic get method to take those 'ids' and to use them in intended way. This may be ignored ,this is only the way VDM has implimented this
Let's go and look at that Data query, I think that's where we will find the use or the implementation of those ids. We are basically reaching into the input object here. We getting cid, [00:09:35](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m35s) selected ids, and we saying tt can be CMD. Then we are exploding it, and we are making sure it is intervals, and we placing it in ids. This actually gets 'this' value from the post object, [00:09:59](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m59s) and places that into ids. Here we do some validation to ensure that the person who's trying to access the data has actualy the right to do it. Once we pass that, we basically use those ids to get the data.
If you want to drop that down, pause the video, and copy some of this area. Probably it would be the only part that will be useful for your purpose. Use the 'ids' in your code as it suits you best.[00:11:39](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m39s) Keep in mind that this PHP as seen in the code, runs before the 'Get methods'. It basically is a filtering option(see video). The 'getListQuery' starts, then that code that has been written, is entered in here(See video) and then the rest of the code which is build by Component Builder is being done. A filter option may be used with whatever you [00:12:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) collected.
In the filter [00:10:20](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m20s) we use ids, and check whether all the ids are in a id and that in the code. Basically if you look at the code, it's on the models combine results. We see that it uses our checking method here. Later down here it checks the ids. [00:10:45](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m45s) Puts it in an array. check if it's in an array then implodes it. Checks whether it gets those ids. That's how we filtered the dataset with the results of the selection. That's just a little bit looking into the back end on how to make use of those [00:11:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m07s) features and you can see, it's some custom scripting we added to the dynamic get method. To take those ids and to use them in the way we intend. You can ignore them, but here is the way that I implemented it.
If you want to drop that down, pause the video, and copy some of this area here. I think it would be the only part that will be useful to your purpose. Then you can use the ids in your code [00:11:39](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m39s) as you please. Know that this php as you saw in the code, it runs before the get methods. It basically is a filtering option as you see there(see video). This query starts, then that code be wrote, is entered in here and then the rest of the code which is build by component builder is being done. You can use a filter option with whatever you [00:12:07](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m07s) collected up here. That's Looking into adding custom admin views to component builder. Just showing you again the tremendous leverage and design choices you can make in ensuring that your component is dynamic, and get sort of breaks out of the mold so that you can achieve [00:12:32](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m32s) nice complex components write inside component builder.
That was a glimpse into adding Custom Admin Views to Component Builder. The tremendous leverage and design choices you can make in ensuring that your component is dynamic has been shown. [00:12:32](https://www.youtube.com/watch?v=sPEkbuNXwds&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h12m32s)