2024-06-17 17:33:29 +07:00
import mysql . connector as mariadb
from mako . template import Template
from config import globalvar , database
2024-06-17 12:43:51 +07:00
2024-06-17 17:33:29 +07:00
class home :
2024-06-17 12:43:51 +07:00
def __init__ ( self ) :
2024-06-17 17:33:29 +07:00
self . db_main = mariadb . connect ( * * database . db_main )
self . cursor = self . db_main . cursor ( dictionary = True )
self . user_roles = [ 0 ] # Cari user roles disini
2024-06-17 12:43:51 +07:00
def html ( self , params ) :
2024-06-17 17:33:29 +07:00
active_page = " Home "
2024-06-17 12:43:51 +07:00
return Template ( params [ " mako " ] [ " website " ] [ ' index ' ] ) . render (
title = globalvar . title ,
2024-06-17 17:33:29 +07:00
header = globalvar . header ,
2024-06-17 12:43:51 +07:00
navbar = Template ( params [ " mako " ] [ " website " ] [ ' navbar ' ] ) . render (
menu = globalvar . menu [ ' public ' ] [ ' navbar ' ] ,
2024-06-17 17:33:29 +07:00
user_roles = self . user_roles ,
active_page = active_page
2024-06-17 12:43:51 +07:00
) ,
footer = Template ( params [ " mako " ] [ " website " ] [ ' footer ' ] ) . render (
copyright = globalvar . copyright ,
) ,
container = Template ( params [ " mako " ] [ " website " ] [ ' container ' ] ) . render (
greeting = f " Welcome to your new web application! This placeholder page is here to let you know that your web framework is successfully set up and ready to go. Now, it ' s time to start building your project. Dive into the documentation to explore the features and capabilities at your disposal. "
)
)