<?php
// This script and data application were generated by AppGini 4.3
// Download AppGini for free from http://www.bigprof.com/appgini/download/

	include(dirname(__FILE__)."/defaultLang.php");
	include(dirname(__FILE__)."/language.php");
	include(dirname(__FILE__)."/lib.php");
	include(dirname(__FILE__)."/tcg_dml.php");
	// mm: can the current member access this page?
	$perm=getTablePermissions('tcg');
	if(!$perm[0]){
		echo StyleSheet();
		echo "<div class=\"error\">".$Translation['tableAccessDenied']."</div>";
		echo '<script language="javaScript">setInterval("window.location=\'index.php?signOut=1\'", 2000);</script>';
		exit;
	}

	$x = new DataList;
	$x->TableName = "tcg";

	// Fields that can be displayed in the table view
	$x->QueryFieldsTV=array(
		"tcg.SlNo" => "SlNo",
		"tcg.PrgNo" => "PrgNo",
		"tcg.PrgName" => "PrgName",
		"tcg.InvoiceNo" => "InvoiceNo",
		"tcg.ClientsName" => "ClientsName",
		"tcg.Dates" => "Dates",
		"tcg.Days" => "Days",
		"tcg.ProfFee" => "ProfFee",
		"tcg.TrainerName" => "TrainerName",
		"tcg.TrainerFee" => "TrainerFee",
		"tcg.ReimbExp" => "ReimbExp",
		"tcg.HandoutChg" => "HandoutChg",
		"tcg.TotalInvAmt" => "TotalInvAmt",
		"tcg.FeeRecd" => "FeeRecd"
	);
	// Fields that can be displayed in the csv file
	$x->QueryFieldsCSV=array(
		"tcg.SlNo" => "SlNo",
		"tcg.PrgNo" => "PrgNo",
		"tcg.PrgName" => "PrgName",
		"tcg.InvoiceNo" => "InvoiceNo",
		"tcg.ClientsName" => "ClientsName",
		"tcg.Dates" => "Dates",
		"tcg.Days" => "Days",
		"tcg.ProfFee" => "ProfFee",
		"tcg.TrainerName" => "TrainerName",
		"tcg.TrainerFee" => "TrainerFee",
		"tcg.ReimbExp" => "ReimbExp",
		"tcg.HandoutChg" => "HandoutChg",
		"tcg.TotalInvAmt" => "TotalInvAmt",
		"tcg.FeeRecd" => "FeeRecd"
	);
	// Fields that can be filtered
	$x->QueryFieldsFilters=array(
		"tcg.SlNo" => "SlNo",
		"tcg.PrgNo" => "PrgNo",
		"tcg.PrgName" => "PrgName",
		"tcg.InvoiceNo" => "InvoiceNo",
		"tcg.ClientsName" => "ClientsName",
		"tcg.Dates" => "Dates",
		"tcg.Days" => "Days",
		"tcg.ProfFee" => "ProfFee",
		"tcg.TrainerName" => "TrainerName",
		"tcg.TrainerFee" => "TrainerFee",
		"tcg.ReimbExp" => "ReimbExp",
		"tcg.HandoutChg" => "HandoutChg",
		"tcg.TotalInvAmt" => "TotalInvAmt",
		"tcg.FeeRecd" => "FeeRecd"
	);

	$x->QueryFrom="tcg ";
	$x->QueryWhere='';
	$x->QueryOrder='';

	$x->DataHeight = 150;
	$x->AllowSelection = 1;
	$x->HideTableView = ($perm[2]==0 ? 1 : 0);
	$x->AllowDelete = $perm[4];
	$x->AllowInsert = $perm[1];
	$x->AllowUpdate = $perm[3];
	$x->SeparateDV = 0;
	$x->AllowDeleteOfParents = 0;
	$x->AllowFilters = 1;
	$x->AllowSavingFilters = 0;
	$x->AllowSorting = 1;
	$x->AllowNavigation = 1;
	$x->AllowPrinting = 1;
	$x->AllowCSV = 1;
	$x->RecordsPerPage = 10;
	$x->QuickSearch = 3;
	$x->QuickSearchText = $Translation["quick search"];
	$x->ScriptFileName = "tcg_view.php";
	$x->RedirectAfterInsert = "tableName_view.php?SelectedID=#ID#";
	$x->TableTitle = "Tcg";
	$x->PrimaryKey = "tcg.SlNo";

	$x->ColWidth   = array(70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70);
	$x->ColCaption = array("SlNo", "PrgNo", "PrgName", "InvoiceNo", "ClientsName", "Dates", "Days", "ProfFee", "TrainerName", "TrainerFee", "ReimbExp", "HandoutChg", "TotalInvAmt", "FeeRecd");
	$x->ColNumber  = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);

	$x->Template = 'templates/tcg_templateTV.html';
	$x->SelectedTemplate = 'templates/tcg_templateTVS.html';
	$x->ShowTableHeader = 1;
	$x->ShowRecordSlots = 0;
	$x->HighlightColor = '#FFF0C2';

	// mm: build the query based on current member's permissions
	if($perm[2]==1){ // view owner only
		$x->QueryFrom.=', membership_userrecords';
		$x->QueryWhere="where tcg.SlNo=membership_userrecords.pkValue and membership_userrecords.tableName='tcg' and lcase(membership_userrecords.memberID)='".getLoggedMemberID()."'";
	}elseif($perm[2]==2){ // view group only
		$x->QueryFrom.=', membership_userrecords';
		$x->QueryWhere="where tcg.SlNo=membership_userrecords.pkValue and membership_userrecords.tableName='tcg' and membership_userrecords.groupID='".getLoggedGroupID()."'";
	}elseif($perm[2]==3){ // view all
		// no further action
	}elseif($perm[2]==0){ // view none
		$x->QueryFields = array("Not enough permissions" => "NEP");
		$x->QueryFrom = 'tcg';
		$x->QueryWhere = '';
		$x->DefaultSortField = '';
	}

	// handle date sorting correctly
	// end of date sorting handler

	$x->Render();

	include(dirname(__FILE__)."/header.php");
	echo $x->HTML;
	include(dirname(__FILE__)."/footer.php");
?><center><font size=-2><?php echo $Translation["powered by"]; ?> Vimal Anand @ 91-998-567-3219</font></center>

Hello,

The above code is generated by a software after connecting it to the database. The output is very nice but how do I write this kind of code. Or what do I need to learn to write or customize this code.

Please help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.