How do I enter text on the children tables

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
nycwebmaster
Veteran Member
Posts: 90
Joined: 2015-11-23 01:02

How do I enter text on the children tables

Post by nycwebmaster » 2020-03-31 20:40

I want to be able to place text in a specific part of the children tables at the bottom of the detail view as described in the picture. Can anyone help me with some code the will accomplish this? I want to be able to change the text/instructions when the user clicks on the different tabs. Thanks.



Image

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

Re: How do I enter text on the children tables

Post by onoehring » 2020-04-03 09:17

Hi nycwebmaster,

I had a similar wish. I did place some text to the right of the record counter - but this interfered with jsetzers AppGiniHelper (highly recommended).
So I changed my settings and I am placing text below the record navigation arrows (see image). The text shown there depends on the tab - the different infos read "(10 Bilder max..." and "(50 Dokumente ..." and should be easy to adjust/extend:
additional_text2.gif
additional_text2.gif (73.81 KiB) Viewed 3542 times
I am using this code in /hooks/tablename.php -> function tablename_footer

Code: Select all

$BilderMaxAnzahl = 'add your text somehow to this variable';
$BilderMaxAnzahl = '<div class="titelHinweis">' . $BilderMaxAnzahl . '</div>';
//you might want to check out this:
// src: https://forums.appgini.com/phpbb/viewtopic.php?f=2&t=3102&p=10355#p10355

$BilderMaxAnzahlHinweis = "<script>\$j('.page-header a').append(' " . $BilderMaxAnzahl . "');</script>";
$BilderMaxAnzahlHinweis = "<script>\$j('body > div.container > div.row > div.col-xs-12 > form > div.page-header').append(' " . $BilderMaxAnzahl . "');</script>";

...

	switch ($contentType) {
		case 'tableview':
			$footer = $BilderMaxAnzahlHinweis . "<%%FOOTER%%>";
			break;

		case 'detailview':
			$footer = $BilderMaxAnzahlHinweis . "<%%FOOTER%%>";
			break;

		case 'tableview+detailview':
			$footer = $BilderMaxAnzahlHinweis . "<%%FOOTER%%>";
			break;
...			

Hope this helps as a starting point.

Olaf

nycwebmaster
Veteran Member
Posts: 90
Joined: 2015-11-23 01:02

Re: How do I enter text on the children tables

Post by nycwebmaster » 2020-04-10 21:14

It did not worked as intended. I'm including my Event.php from the hooks folder to show what I did. The text showed only below the title of the table view also below the title of the detailed view but not on the children tables as I described on the pictures. Can you please check what I'm doing wrong... here is my Event.php code:

Code: Select all

<?php
	// For help on using hooks, please refer to https://bigprof.com/appgini/help/working-with-generated-web-database-application/hooks

	function Event_init(&$options, $memberInfo, &$args){
		

		return TRUE;
	}

	function Event_header($contentType, $memberInfo, &$args){
		$header='';

		switch($contentType){
			case 'tableview':
				$header='';
				break;

			case 'detailview':
				$header='';
				break;

			case 'tableview+detailview':
				$header='';
				break;

			case 'print-tableview':
				$header='';
				break;

			case 'print-detailview':
				$header='';
				break;

			case 'filters':
				$header='';
				break;
		}

		return $header;
	}

	function Event_footer($contentType, $memberInfo, &$args){
		$BilderMaxAnzahl = 'add your text somehow to this variable';
$BilderMaxAnzahl = '<div class="titelHinweis">' . $BilderMaxAnzahl . '</div>';
//you might want to check out this:
// src: https://forums.appgini.com/phpbb/viewtopic.php?f=2&t=3102&p=10355#p10355

$BilderMaxAnzahlHinweis = "<script>\$j('.page-header a').append(' " . $BilderMaxAnzahl . "');</script>";
$BilderMaxAnzahlHinweis = "<script>\$j('body > div.container > div.row > div.col-xs-12 > form > div.page-header').append(' " . $BilderMaxAnzahl . "');</script>";
		
		$footer='';

		switch($contentType){
			case 'tableview':
				$footer = $BilderMaxAnzahlHinweis . "<%%FOOTER%%>";
				break;

			case 'detailview':
				$footer = $BilderMaxAnzahlHinweis . "<%%FOOTER%%>";
				break;

			case 'tableview+detailview':
				$footer = $BilderMaxAnzahlHinweis . "<%%FOOTER%%>";
				break;

			case 'print-tableview':
				$footer='';
				break;

			case 'print-detailview':
				$footer='';
				break;

			case 'filters':
				$footer='';
				break;
		}

		return $footer;
	}

	function Event_before_insert(&$data, $memberInfo, &$args){

		return TRUE;
	}

	function Event_after_insert($data, $memberInfo, &$args){
		
		
				$link = application_url('Event_view.php') . '?SelectedID=' . urlencode($data['selectedID']);
		sendmail([
   'to' => '[email protected]',
   'subject' => 'A new event has been created',
   'message' => "<a href=\"{$link}\">View or edit this record here</a>"
]);


		
		
		
		
		
		
		
		
		
		
		
		
		
		

		return TRUE;
	}

	function Event_before_update(&$data, $memberInfo, &$args){

		return TRUE;
	}

	function Event_after_update($data, $memberInfo, &$args){
		
						$link = application_url('Event_view.php') . '?SelectedID=' . urlencode($data['selectedID']);
		sendmail([
   'to' => '[email protected]',
   'subject' => 'A new event has been updated',
   'message' => "<a href=\"{$link}\">View or edit this record here</a>"
]);

		
		
		

		return TRUE;
	}

	function Event_before_delete($selectedID, &$skipChecks, $memberInfo, &$args){

		return TRUE;
	}

	function Event_after_delete($selectedID, $memberInfo, &$args){

	}

	function Event_dv($selectedID, $memberInfo, &$html, &$args){
		
		/* change the layout only if this is not the print preview */
		if(isset($_REQUEST['dvprint_x'])) return;
		
		ob_start(); ?>
		
		<script>
			$j(function(){
				$j('fieldset.form-horizontal').removeClass('form-horizontal').addClass('form-inline');
				
				/* Fix for a bug with lookup drop-downs and date fields to set their correct width */
				setInterval(function() {
					$j('.select2-container')
						.parents('.form-control-static')
						.removeClass('form-control-static');
					$j('table.form-control-static').removeClass('form-control-static');
				}, 1000);
			})
		</script>
		
		<style>
			@media (min-width: 768px){
				.form-inline .form-group{
					width: 48%;
					margin-bottom: 0.75em;
					vertical-align: top;
				}
			}
			/* fixing width of input fields */
			.form-inline .form-control {
				width: 100% !important;
			}
		</style>
		
		<?php
		$new_layout = ob_get_contents();
		ob_end_clean();
		
		$html .= $new_layout;
	
		// add button for owner change if we have an exisitng record and the user is not admin
		if (!empty($selectedID) && !$memberInfo['admin']) {
			ob_start();
		?>
				<script>
				$j(function() {
					$j('.panel-title').append('<a href="#" id="selected_records_mass_change_owner_new"><span class="" style="float:right"><i class="glyphicon glyphicon-user"></i> Assign new owner</span></a>');
				
					$j('[id=selected_records_mass_change_owner_new]').click(function(){ 
					mass_change_owner_new('Event', [<?php echo $selectedID; ?>]); 
						return false; });
				});
				</script>
		<?php
			$html .= ob_get_contents();
			ob_end_clean();
		}	
		
		
		
		
		
		

	}

	function Event_csv($query, $memberInfo, &$args){

		return $query;
	}
	function Event_batch_actions(&$args){
		// add batch action for owner change if user is not admin
		if (!getLoggedAdmin()) {
			return array(
				array(	'function' => 'mass_change_owner_new',
					'title' => "Assign new owner",
					'icon' => 'user')
				);
		}
		else {
			return array();
		}
	}




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

Re: How do I enter text on the children tables

Post by onoehring » 2020-04-11 08:02

Hi,

can you please post a screenshot - that would help my imagination ;-)
Thanks
Olaf

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: How do I enter text on the children tables

Post by a.gneady » 2020-06-27 16:54

I want to be able to place text in a specific part of the children tables at the bottom of the detail view as described in the picture. Can anyone help me with some code the will accomplish this? I want to be able to change the text/instructions when the user clicks on the different tabs. Thanks.
Please check this recipe: https://github.com/bigprof-software/app ... ild-tab.md

Image
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

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

Re: How do I enter text on the children tables

Post by onoehring » 2020-06-28 05:41

Hi Ahmed,

thank you for the hint to the cookbook. As I had a similar problem which was solved here in the forum, I wonder, if the cookbook-solution will work with jsetzer's AppGiniHelper. Do you know?

Olaf

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: How do I enter text on the children tables

Post by a.gneady » 2020-06-29 02:42

Didn't test that Olaf. But please let me know if you encounter any error and let's see how to fix it.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply