Navbar Buttons

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
SkayyHH
Veteran Member
Posts: 459
Joined: 2015-04-27 21:18

Navbar Buttons

Post by SkayyHH » 2024-09-06 15:53

I need 2 buttons in the navigation bar and i tried this code in header-extras:

Code: Select all

<?php if(!defined('PREPEND_PATH')) define('PREPEND_PATH', ''); ?>

<script>
	$j(function(){
 		$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>hooks/calendar-kalender.php"><i class="glyphicon glyphicon-list"></i> Wiedervorlagen</a>'); 
		$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>employees_de_view.php"><i class="glyphicon glyphicon-user"></i> Mitarbeiter</a>');
	});
</script>
Can someone please help me modify the code so that the buttons don't appear on the login page?

Thank you very much!

SkayyHH
Veteran Member
Posts: 459
Joined: 2015-04-27 21:18

Re: Navbar Buttons

Post by SkayyHH » 2024-09-06 16:13

There's one thing I forgot. The session ID needs to be appended to the button link (here employee_de). Unfortunately, I wasn't able to manage that. So like this: employees_de_view.php?t=1725639003

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1658
Joined: 2018-04-01 10:12

Re: Navbar Buttons

Post by pbottcher » 2024-09-14 18:42

Hi,

you may try in your script:

Code: Select all

	$j(function(){
		if (window.location.href.indexOf('index.php') == -1) {
			$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>hooks/calendar-kalender.php"><i class="glyphicon glyphicon-list"></i> Wiedervorlagen</a>'); 
			$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>employees_de_view.php"><i class="glyphicon glyphicon-user"></i> Mitarbeiter</a>');
		}
	});
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply