Steps to Create a Management Users Menu in PHPMaker
Hi all! Welcome to PHPMaker tutorial Series..
Today we will learn about how to make management user menu in PHPMaker.
1. Set Up Users Table and Master Users Table In The Database
When entering user data into the Users Table, users don’t need to type it manually. Instead, they can use the master table as a reference and utilize the autofill feature in PHPMaker to automatically populate the Users Table. The master table contains all company users, while the Users Table includes only those specific users who have been granted access to the website. Make sure the primary key of Users Table is the foreign key in Master Users, also Users Table must include role, username, password, user’s name, key user. These fields important for the further step.
2. Import The Tables Into PHPMaker
Import tables into phpmaker by click the Synchronize Button.
make sure primary key of master_users is checked.
3. Configure The Role and Security Settings
After importing the tables, click Security tab
After chosing security tab, let’s define our users table. Check “Use Existing Table” and choose our users table. Define the username and password field as we defined in database before. Click “Advance” to setup the role and security.
configure the users level as shown below :
In PHPMaker, each user category or level has a unique role value. As shown in Picture 4, these user categories range from Anonymous to pt_utama, each assigned a specific integer value: Anonymous is -2, Administrator is -1, Default is 0, and so on, up to pt_utama at 3. These values must align with the corresponding role values in the database. Anonymous users can access the site without logging in, while default users can only access it after logging in successfully.
To add new levels, right click on “User levels” then click add user :
We can configure which menus are allowed to each user :
Make sure on the Default role, users table cannot add, delete, edit. We will make view from users table on the next step.
4. Make Custom View of Users Table
After configuring the roles and security settings, the next step is to set up the users table. In PHPMaker, it is not recommended to perform CRUD operations directly on the users table. Instead, create a custom view from this table and perform CRUD operations on the custom view. Let’s name this custom view v_manajemen_user
. Here are the steps:
Right click on “Custom Views” :
Select “No” Option for this dialogue
Rename the custom view and add the object
Chose Users Table because our object of this custom view is Users Table
Choose All columns and click OK.
Now We have “new” Users Table called v_manajemen_users. We will perform CRUD of Users Data on this table.
5. Configure The “New” Users Table
To perform CRUD Data in our new Users Table, we have to ensure the security is already set-up. Go to Security tab setting
on Default level, make sure add, edit, delete, list, lookup, search, view is already checked.
also, make sure the lookup for master users is already checked.
Click Ok then go back to v_manajemen_users:
Let’s make automatic fill while inserting the table. First, setup the Look-up Table on NRP (key) column :
Customize the autofill feature :
Scroll down on the left-down of the window and find the autofill column. Change the value to “True” as shown below :
then clicked the circled button as shown below :
then the autofill menu will shown :
chose the column that will be autofill by master table. then click OK.
then let’s configure the CRUD, click the v_manajemen_user then choose the Table tab then configure as shown below :
6. Customize The Menu
After setting the new users table, let’s configure the menu. Click menu editor
On the menu Item rename the v_manajemen_users to “Manajemen User” as shown below :
make sure to check navbar Item so the menu will be placed on header, if navbar item is not checked then the menu will be placed on sidebar. Anonymous User is not allowed to access it so don’t check the “Allow Anonymous User”.
7. Generate The Project
Generate the project and call it on localhost.
The result will be looks like this
That’s All.
Thank you for reading, and happy learning!