Skip to content

018 Custom Admin Views

Amigo edited this page May 14, 2019 · 12 revisions

We need to have a quick look at custom admin views 00:00:04 They do have some nice ways of doing things Very similar to sight views But some Aspects and adding it to component builder is different And so in the next video We will look at adding site views as well as component Custom admin Views To the component The reason I didn't speak much about the custom admin views is simply because Summon distributor is not 00:00:33 Using Custom admin views yet Where is I have another component here I can use as a example Called component Is called Cost-benefit projection It's a It's a tool that is used to show companies the cost benefits Of intervening on certain diseases and causes in the company Anyway 00:01:04 In it we have what we call a company results And combined results Respectively used To display custom data In the back end of the component to the certain different people who has permission to view those data Now in the component itself If we clicked on companies You would see there is an icon underneath each of these 00:01:36 Names of the Companies And there is a new button here the top called combine Results Now This button as well as those buttons Are dynamically added by component Builder And in the next tutorial I'll show you exactly how that is done What I want to show you here is Simply how a custom admin view will look So I'm gonna click on one of these, this is all dumb information so 00:02:07 So you'll see me Let's open this one Now basically you have this big area where you could put a lot of HTML and PHP And you have some custom buttons that you can add on show you that And then So all of this in this white area is simply done in the custom View So if I was to click around I've got a menu here at the side All of this is done inside of the custom Area 00:02:44 Of the component Which is now the Custom admin View And That is basically how it will look It has Different Value sets And you can from here add an edit button Since we've linked it to a specific client Or company or one item in that list 00:03:10 We can actually click on edit From here we go right into the company's data And edit it And What is nice if we were to click close here You actually take us back to that Exact result page And you can then go and look at The implementation What you've done 00:03:35 Is it that is just simply showing you how a custom admin view could look Let's go back to the company's list or we could go back to dashboard now look at component Builder And we looked at this company results we open that one And here is all PHP and HTML On my page Doing all the work And of course As you might expect I'm loading in a lot of templates here 00:04:05 So I'm loading in templates Directly From here And Then I have a custom button area Where I can I can say yes I want to add custom buttons Then I click on Custom buttons here and you see I have Icons I can select Call it 00:04:25 The name of the button And a controller method Which I would like to use to actually make the button work so in this one I'm saying go to company This one is edit company And here I should say Is this gonna What kind of Target are we think looking at Is this a A single a list or both 00:04:52 And you said that respectively And Then you click save this only saves it to the form not to the database We should have made that done But this is the Joomla's way of implementing it And now you have to add In the PHP controller method Add scripting to respectively implement the buttons click Method 00:05:16 You can also to the model So in the controller You can add script and then in the model Add scripting which is called from the controller if you want to separate your code a bit In the in the and if you're not gonna be adding Any script to the model Just add none with this two Spaces in front otherwise it might scream at you that you did not add Script there And as you can see the go to companies is simply 00:05:47 Take me back to the company's View Where as the Edit company Implements the Joomla's convention of opening an item to edit it By the correct channels so this is just Joomla knowledge At work here And we are checking a token and all that So do Component Builders sets of all the tokens and everything So you 00:06:13 The snippet you can reuse for your purposes if you want And obviously we have an area for custom scripting and as you can expect There's a lot of custom scripting Going on In in that View And it has its respective places again if you wanna know where what's happening at some snippet here Compiler components search for that snippet and you'll see where this comes up If you're not certain by the naming conventions we have used And that is really how you setup a admin custom admin View 00:06:51 To look at the other one Let's close out here That is the combined results View Now the combined results is this one up here if you click it now I will tell you this in we need to have some item selected And then you select the items and click There again And it will do a combined resolve Taking both companies And Adding it's data together 00:07:16 And giving you a nice layout structure Of it's data sets Ok That is really the combined concept If we go back To the implementation of it It looks very similar as the other Again just a lot of HTML PHP here And then Also some custom button is again just going back to companies 00:07:41 And it's really just same implementation V card companies go back single And then some custom scripting And that's how I set up both of those custom views quite simply Adding that the data here And then making use of the templates as well as layout implementation in both of these So you can set up layouts and templates and Only use them and site views But you can also use them in admin views Now 00:08:11 In our next tutorial We look at how to add site views and admin views to your component Since there are some differences And you need to be aware of them

Clone this wiki locally