Updated 007 Admin Views (markdown)
parent
7a5b99f1c6
commit
67418f0de8
@ -47,19 +47,23 @@ The tab structure. We call these tabs. (See video.) [00:19:27](https://www.youtu
|
||||
|
||||
In 'Preacher' I set up two tabs: one called 'Details' and one called 'Sermons.' [00:20:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m32s) So there are two tabs in 'Preacher' which means that if you were to open the 'Preacher' back end view the first one would be called settings and the second one will be called sermons.
|
||||
|
||||
* **Fields Linking**
|
||||
**Linked Views**
|
||||
|
||||
When you create fields [00:20:53](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m53s) you'd see a column here called tab, and you then will select the number. Now the tabs are number from one to whatever. We don't start at zero although that might have made more sense for programmers we started with one. So first tab, second tab, and because we are using [00:21:15](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m15s) a place different from the tabs. We don't use the names. So you need to remember that this is tab one, this is tab two. So when you set up a field you need to tell us in which tab you want to place that field. So that is what this tab number here is all about. [00:21:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m35s) Now you might say but where is tab two's information because they are sermons right. Well because of the fact that sermons is actually a table on its own. If we go out here we will see that there is a admin view called sermon, and it has its own back end view, [00:22:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m02s) and it has its own structure. So how can I get the sermons that is only related to this preacher to be showing in the second tab called sermons? Well we created a thing called linked views.
|
||||
When you create fields you'd see a column called tab in which you'd select a number, from one upward. [00:20:53](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h20m53s) Because we are using a different location than the tabs, we don't use the names. [00:21:15](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m15s) When you set up a field, you need to tell in which tab you want to place that field. That is what the tab number is all about. [00:21:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h21m35s) You might wonder where tab two's information is. 'Sermons' is actually a table on its own; there is an admin view called sermon, and it has its own back end view and structure. [00:22:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m02s) We created a thing called 'Linked Views' to get the 'sermons' related to this 'preacher' to show in the second tab, 'sermons.' (See video.) [00:22:25](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m25s) Selecting 'sermon' as the view, I set it to be placed in the second tab. The 'Parent Key' would be the view in which you are the moment that you are setting up the linked view. [00:22:49](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m49s) It depends on the view you are editing. Hence, if you are in 'preacher' the parent is 'preacher;' if you are in 'sermons,' the parent is 'sermon.' So in this case, when we talk about the child key ('preachers') it would be the database field name that is to be looked at. [00:23:10](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m10s) The parent field name ('id') would be found in 'preachers.' [00:23:38](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m38s)
|
||||
|
||||
* **Fields Linked Views**
|
||||
If you go to fields you will see a field called 'Sermon: Preacher'. This is the field that we want connected. [00:24:10](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m10s) To get the sermons belonging to that 'Preacher,' we need to get the ID of this field. [00:24:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m35s) Opening this field you will find that it's name is preacher. That field will be connected to 'sermon,' so it means that in the database the ID, which is the key field, is going to be saved in 'preacher.' That means the ID of the preacher is saved inside of the preacher column in the database. [00:24:55](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m55s) You can see this in the database. Open 'sermondistributor_sermons' and find 'preacher.' It has ID's in it and those are the preachers' IDs. So we are linking the 'preachers' to these IDs here. [00:25:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m24s)
|
||||
|
||||
Now linked views is the place where this is done. [00:22:25](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m25s) So basically I selected sermon as the view, I said it should be placed in the second tab, and in child key, is preacher. So if I think about sermons which is the child, sermon is the child, preacher is the parent. So you would always think of the parent as the view in which you are, the moment you are setting up the linked view. [00:22:49](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h22m49s) So that if you are in preacher the parent is preacher, if you are in sermons, the parent is sermon. So it depends on which view you are busy editing. And so here when we talk about the child key, this would be the database field name [00:23:10](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m10s) that is to be looked at, and the parent field name, that should be found inside of preachers. So when we look at preachers you should go back to sermon. [00:23:38](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h23m38s)
|
||||
In the child database table, the ID of this preacher must be found. [00:25:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m43s) The parent key would be this preacher's ID. Now the linked view will only show the sermons that are related to this specific preacher. That is how the linked views can be linked. If you didn't select these correctly, it won't work well. [00:26:05](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m05s) There needs to be a close relationship between the parent and child view. [00:26:23](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m23s)
|
||||
|
||||
If you go to fields you will see that there is a field called 'name'. There is a field called 'preacher'. This is the field that we want [00:24:10](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m10s) connected with each other. So to get the sermons that belongs to that preacher, we need to get the ID of this field. Now that is a custom field. And we said that we are going to look at custom fields only after explaining the admin views. So I'm going to go into detail now but I'm going to open that field none the less and I'm going to show you that its name is preacher. [00:24:35](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m35s) And because that field will be connected to sermon it means that in the database the ID which is the key field is going to be saved in preacher. So that means the ID of the preacher is saved inside of the preacher column, in the database. [00:24:55](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h24m55s) Now let me show you that in the database itself, so here in the database with sermon distributor and then open sermons and scroll until we see preacher. And it has ID's in it and those are the IDs of the preacher's themselves. So if I was to go to preacher, it basically means that we are linking [00:25:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m24s) to this ID here. So going back to our linked view concept, that means the child database table, in which the ID of this preacher must be found is in preacher. [00:25:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h25m43s) The parent key would be this preachers ID and so by doing that, the linked view will only show the sermons that are related to this specific preacher. And that is how the linked views can be linked. If you didn't select these correctly, it won't load all of them [00:26:05](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m05s) It won't work well. So there needs to be that tight relationship between the parent and the child view. So there is also a way to actually link from an array so let's say; [00:26:23](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m23s) the person is able to select more than one preacher, there is a way for you to also type that, but that would all be dealt with in advanced concepts. I could explain some of it here but let me show you what would be one of the syntax(>) to use. [00:26:48](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h26m48s) Possibly I need to deal with this in advanced concepts. So the basic way of linking another view would be to select that view from this drop down(under Sermons). Then say in which tab it should display. Then [00:27:12](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m12s) what is the child database table in which to look, what is the parents value to use to build a relationship. And then this add new button yes or no, is basically when you look at fields here, you see it has a 'new' button. [00:27:38](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m38s) So you can in that switch (add new button) decide whether it should show it or not. If you say yes and you have in that view created the correct permissional structure for somebody to create an item, you can control the display of that 'new" button [00:28:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m02s) with just setting the permission of that users specific group. So if that user is in a group that does not have permission to create new items, for in this example, for preachers or for sermons, then that 'new' button will also not show up. So we have that permissional wrapped around that button's display methods. [00:28:26](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m26s)
|
||||
The basic way of linking another view would be to select that view from 'Sermons' drop down; set in which tab it should display, what child database table in which to look, and which parent's value to use to build a relationship. [00:27:12](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m12s) Then there is 'Add New Button' option of 'yes' or 'no.' [00:27:38](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h27m38s) You can decide whether it should show or not. If you say 'yes' and you have, in that view, created the permissional structure for whether somebody can create an item or not, you can control the display of that button by setting the permission of that user's specific group. [00:28:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m02s) If that user is in a group that does not have permission to create new items, then the 'new' button will not show up. [00:28:26](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m26s)
|
||||
|
||||
As we were looking at the tabs I have explaining to you how to link other views to it so that you can have the data displayed inside of each other. [00:28:43](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h28m43s) Basically this feature we have here so the fact that we are busy in preachers and we are able to display the fields that are being used. As you can imagine these fields are linked to preachers from this column here, so we are using a repeatable field structure [00:29:05](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m05s) and we are able to connect the field names to this view.
|
||||
The feature that I have explained to you shows that we are busy in preachers and it is able to display the fields that are being used. The fields are linked to preachers from this column (see video), so we are using a repeatable field structure and we are able to connect the field names to this view. [00:29:05](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m05s)
|
||||
|
||||
Now let me show you how I did that. So I'm going to open the admin view which is the one we looking at. [00:29:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m32s) I'm going to link views and you see that I have there a 'R' in the pointer and the word field so if you are trying to connect a view from the parent. And in the parent it is stored in 'addfields' that is the database [00:29:54](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m54s) column name. So if we go to the database, go to Component Builder, admin views and we scroll, you would see there is addfields and if I open that you see that the way it stores it. It stores the ID, then it stores the list. [00:30:21](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m21s) So there's a way in which your repeatable fields are stored by Joomla. and the value that I need to look up is in field. So in the repeatable field called addfields there is a field called 'field'. And it should look for the ID of the fields. So it need to look in addfields [00:30:51](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m51s) in the field array for the IDs, that it needs to fetch, and the way you would mapped that in the connect a linked view is you would say that this is a capital 'R' for repeatable fields basically that is the convention to to tell the system it's a repeatable field we looking in [00:31:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m14s) and inside of the repeatable field we must look in the field array for those ID's and they should mapped to the child's ID. So does that make sense I hope so. Because that's the way it's done. And if that wasn't a repeatable field but an array you would simply say array [00:31:34](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m34s) and if the array is just the values themselves you would drop off any pointer to specific value. But if it's an associative array you would just add the name of the associative key that it needs to look in. [00:32:00](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m00s) If it's just a normal array without association leave it like that so this would just tell the system it is a array and it needs to look inside of those values for these IDs. So that's sort of explains the linking of an admin view to another admin view. Now getting on with the setting up of fields. [00:32:28](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m28s)
|
||||
This is how I did that. Open the admin view, which is the one we looking at. (See video.) [00:29:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m32s) Go to 'Linked Views.' There is an 'R' in the pointer as well as the word 'field.' If you are trying to connect a view from the parent, where it is stored in 'addfields' which is the database column name. [00:29:54](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h29m54s)
|
||||
|
||||
|
||||
|
||||
Now go to database, Component Builder, admin views, and if you scroll, you'd see 'addfields.' If I open that, you'd see that it stores the ID, then the list. [00:30:21](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m21s) There's a way in which your repeatable fields are stored by Joomla.The value that I need to look up is in field. In the repeatable field called addfields there is a field called 'field'. And it should look for the ID of the fields. So it need to look in addfields [00:30:51](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h30m51s) in the field array for the IDs, that it needs to fetch, and the way you would mapped that in the connect a linked view is you would say that this is a capital 'R' for repeatable fields basically that is the convention to to tell the system it's a repeatable field we looking in [00:31:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m14s) and inside of the repeatable field we must look in the field array for those ID's and they should mapped to the child's ID. So does that make sense I hope so. Because that's the way it's done. And if that wasn't a repeatable field but an array you would simply say array [00:31:34](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h31m34s) and if the array is just the values themselves you would drop off any pointer to specific value. But if it's an associative array you would just add the name of the associative key that it needs to look in. [00:32:00](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m00s) If it's just a normal array without association leave it like that so this would just tell the system it is a array and it needs to look inside of those values for these IDs. So that's sort of explains the linking of an admin view to another admin view. Now getting on with the setting up of fields. [00:32:28](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h32m28s)
|
||||
|
||||
**Fields**
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user