Topic: Hooking Up an Extension
I'm trying to install new extension but so far I'm failed to achieved what I wanted. I'm trying to install new :
1. Tab
2. Menu/Link
3. Security Access
So far I have :
1. Create a directory named "claim" inside "modules" directory.
2. Create file named "hooks.php" inside "claim" directory and it looks like this :
<?php
define ('SS_CL',71<<8);
class hooks_claim extends hooks {
var $module_name = 'claim'; // extension module name.
function install_tabs($app) {
set_ext_domain('modules/claim'); // set text domain for gettext
$app->add_application(new claim_app); // add menu tab defined by example_class
set_ext_domain();
}
function install_access()
{
$security_sections[SS_CL] = _("Claim");
$security_areas['SA_CLAPPLY'] = array(SS_CL|1, _("Claim Application"));
$security_areas['SA_CLCHECK'] = array(SS_CL|2, _("Check Claim"));
$security_areas['SA_CLAPPROVE'] = array(SS_CL|3, _("Approve Claim"));
$security_areas['SA_CLPAYMENT'] = array(SS_CL|4, _("Release Payment"));
$security_areas['SA_CLVIEW'] = array(SS_CL|5, _("View My Claim"));
return array($security_areas, $security_sections);
}
}
?>
Result : I got blank/empty page.
I knew that I don't have any problem with the "install_access". So I figured that I have problem with the following line in install_tabs :
$app->add_application(new claim_app); // add menu tab defined by example_class
Don't have any idea of what it's mean but I'm sure that what causing the problem. So I ended up create a new file named "claim.php" inside "application" directory. And it looks like this :
<?php
class claim_app extends application
{
function claim_app()
{
$this->application("claim", _($this->help_context = "&Claim"));
$this->add_module(_("Claim Application"));
$this->add_lapp_function(0, _("Sales Travelling Claim"),
$path_to_root.'/modules/claim/travel.php', 'SA_CLAPPLY', MENU_CLAIM);
$this->add_lapp_function(0, _("Overtime Claim"),
$path_to_root.'/modules/claim/overtime.php', 'SA_CLAPPLY', MENU_CLAIM);
$this->add_lapp_function(0, _("Monthly Claim"),
$path_to_root.'/modules/claim/monthly.php', 'SA_CLAPPLY', MENU_CLAIM);
$this->add_lapp_function(0, _("Petty Cash"),
$path_to_root.'/modules/claim/pettycash.php', 'SA_CLAPPLY', MENU_CLAIM);
$this->add_lapp_function(0, "","");
$this->add_rapp_function(0, _("View My Claim"),
$path_to_root.'/modules/claim/myclaim.php', 'SA_CLVIEW', MENU_CLAIM);
$this->add_module(_("Administer Claim"));
$this->add_lapp_function(1, _("Claim Check Up"),
$path_to_root.'/modules/claim/ccheck.php', 'SA_CLCHECK', MENU_CLAIM);
$this->add_lapp_function(1, _("Approved Claim"),
$path_to_root.'/modules/claim/capprove.php', 'SA_CLAPPROVE', MENU_CLAIM);
$this->add_lapp_function(1, _("Claim Payment"),
$path_to_root.'/modules/claim/capprove.php', 'SA_CLPAYMENT', MENU_CLAIM);
$this->add_lapp_function(1, "","");
$this->add_extensions();
}
}
?>
Result : I still got blank/empty page.
What's my mistake? Am I missing something? Really need some guidance here.