Insert the table view of a table on the home page.

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
fgazza
Veteran Member
Posts: 205
Joined: 2019-04-30 17:37

Insert the table view of a table on the home page.

Post by fgazza » 2019-11-15 16:31

Hello everyone!
I need help solving this problem:
I would like to insert in the home page of appgini (I refer to the page visible before login and not to the visible one once logged in!) the table view of a specific table visible to people not logged in.

Is there a way to customize the hook file and get this result?

Here is a simulation of what I would like to do:

now:
now.jpg
now.jpg (70.36 KiB) Viewed 6078 times
my goal:
mygoal.jpg
mygoal.jpg (178.5 KiB) Viewed 6078 times
Thanks!

Fabiano

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Insert the table view of a table on the home page.

Post by ronwill » 2019-11-16 03:08

Is it something like this you are trying to create?

App HOME PAGE:
SharedScreenshot1.jpg
SharedScreenshot1.jpg (50.61 KiB) Viewed 6060 times
I managed this with a small adhoc mod to home.php using an iframe (it would get overwritten unless you make it read only or, as I do, make a saved copy and use file compare after each app generation and copy across the mods again). Plus I add 1 line to header-extras. It seems to work ok in the test I did.

If it's what you are after let me know and I put the details up.

Cheers,
Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

fgazza
Veteran Member
Posts: 205
Joined: 2019-04-30 17:37

Re: Insert the table view of a table on the home page.

Post by fgazza » 2019-11-16 07:17

Yes! That's exactly what I was looking for! I await the details of the code to implement this solution!
Thank you so much!!!
Fabiano

User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Re: Insert the table view of a table on the home page.

Post by ronwill » 2019-11-16 10:29

Ok, this is what I did (there probably is another other coding way)

MOD to header.php

Code: Select all

<!-- ***** ADD FOLLOWING TO TOP OF HEADER.PHP ***** -->
<style> 
  body {margin-top:-100px !important;}  
  <!-- EFFECTIVELY SHIFTS IFRAME UNDER MAIN HEADER adjust -100px to suit
  Note if you have 'enable zooming' on your table thumbnail image then edit to suit
  making sure pop-up image is not under the showing page header-->
</style>
<style>
  footer {display:none;}
  <!-- might not be needed, worked with/without in my example test -->
</style>
<!-- ***** NOW ADD IFRAME AT LINE 55 BELOW ***** -->
 
<?php 
	if(!isset($Translation)) { @header('Location: index.php'); exit; } 

	$currDir = dirname(__FILE__);
	include_once("{$currDir}/header.php");
	@include("{$currDir}/hooks/links-home.php");

	/*
		Classes of first and other blocks
		---------------------------------
		For possible classes, refer to the Bootstrap grid columns, panels and buttons documentation:
			Grid columns: http://getbootstrap.com/css/#grid
			Panels: http://getbootstrap.com/components/#panels
			Buttons: http://getbootstrap.com/css/#buttons
	*/
	$block_classes = array(
		'first' => array(
			'grid_column' => 'col-sm-6 col-md-4 col-lg-3',
			'panel' => 'panel-warning',
			'link' => 'btn-warning'
		),
		'other' => array(
			'grid_column' => 'col-sm-6 col-md-4 col-lg-3',
			'panel' => 'panel-info',
			'link' => 'btn-info'
		)
	);
?>

<style>
	.panel-body-description{
		margin-top: 10px;
		height: auto;
		overflow: auto;
	}
	.panel-body .btn img{
		margin: 0 10px;
		max-height: 32px;
	}
</style>

<!-- ***** ADD IFRAME IN HERE ***** -->
<iframe src="http://localhost/new_app/table1_view.php" style="border: 0" width="100%"  height="700" frameborder="0" scrolling="auto"></iframe>
<div class="clearfix"></div>
<!-- ***** END OF MOD TO THIS FILE: ADJUST src="YOUR FILE LOCATION" and frame height/scrolling etc to suit your needs
Next see mod to /hooks/header.extras that I use to expand width of iframe/table buttons to
fit screen better ***** -->

<?php
	// get member info
	$mi = getMemberInfo();
MOD to hooks/header-extras

Code: Select all

</div><div class="col-lg-12">
Naturallly the table in iframe will run within the iframe. You can depending on your needs, choose to show or hide the button for the iframe table view on homepage and/or nav menu.

Hope this does what you need.
Cheers, Ron
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

fgazza
Veteran Member
Posts: 205
Joined: 2019-04-30 17:37

Re: Insert the table view of a table on the home page.

Post by fgazza » 2019-11-16 10:38

Thank you!
I will try it soon and i will let you know if it's good fom me!
Cheers!
Fabiano.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Insert the table view of a table on the home page.

Post by onoehring » 2019-12-11 16:15

Hi Fabiano,

I can make another suggestion: Let the admin (or even users) decide, on which page they want to start once they have been logged in.
In /hooks/__global.php you find the necessary function: login_ok (see mine below).

I created a new table tbl_startpages (ID_StartpageNum PK, integer; StartpageURL VARCHAR(200)). There are possible starting pages to which the user will be redirected once logged in.
Another new table tbl_usersettings holds the username and the ID_StartpageNum and assigns each user his own startpage.
Now, the users logged in, I read the settings for this user and redirect to that userpage.

Code: Select all

function login_ok($memberInfo, &$args){		
		//start redirect to defined startpage
		$userpage = sqlValue("Select
		tbl_startpages.StartpageURL
		From
		tbl_startpages Inner Join
		tbl_usersettings On tbl_usersettings.ID_StartpageNum = tbl_startpages.ID_StartpageNum
		Where
		tbl_usersettings.ID_Usersettings = '". makeSafe($memberInfo['username'])."'");
		
		if (isset($userpage) && $userpage != '') 
		{
			return $userpage;
		}
		else
		{
			return '';
		}
		//start redirect to defined startpage	
	}	
tbl_startpages looks like this:
Zwischenablage02.png
Zwischenablage02.png (13.06 KiB) Viewed 5710 times
Olaf

Post Reply