Buy Now
Sign in

Show current connection/form infomation as a footer. Version 6

NickOg

Not yet tested in Chronoforms yet but works for Connectivity, Useful keeping track of and reporting problems with connections.forms.

Are there any built in methods to provide this info without my crude code, Max?

				
/** 
* adds form information plus print date to a form or connection
*
* @param type $ccThis this from connection/form
* @param type $thePage
* @return NULL
*/
function showFormFooterV6($ccThis, $thePage = NULL) {
/** @var \stdClass Container for the form/connection information **/
$theFormInfo = new stdClass();
/** @var \StdClass The description of the form or connection **/
$theConnection = $ccThis->vars['__connection'];
/** abbreviate the full extension name **/
switch ($ccThis->extension) {
case 'chronoconnectivity':
$theFormInfo->type = 'CC';
break;
case 'chronoform':
/** @todo Not yet tested this for chronoforms **/
$theFormInfo->type = 'CF';
break;
default:
$aMessage='Bad chronoengine type';
writeLogAndSystemMessageV5($aMessage, $aMessage, 'ERROR');
break;
}
/** @var string the form or connection id from the designer **/
$theFormInfo->id = $theConnection['id'];
/** @var string the form name (alias) **/
$theFormInfo->name = $theConnection['alias'];
$theFormInfo->printString = "<div style='font-size:10px;display: inline-block !important;width:100%;'>";
/** @var string This year **/
$thisYear = getThisYearV5()->thisYear;
/** @var string the form footer to print **/
$theFormInfo->printString .= $theFormInfo->name . ": Form ID ". $theFormInfo->id. "(V6".$theFormInfo->type.")" . $thePage . " &copyPMHU3A $thisYear";
$theFormInfo->printString .= "<span style='float:right;'>" . dateprintedV5() . "</span>";
$theFormInfo->printString .= "</div>";
echo $theFormInfo->printString;
return NULL;
}


A couple of the calls are to other simple functions not included in this topic (eg getThisYearV5, dateprintedV5).

Output looks like this
MembershipHistory: Form ID 22(V6CC) ©PMHU3A 2017 Printed 29-May-2017

admin

Hi Nick,

The following PHP code can be used to get the current connection/form data:

				
$connection = $this->_connection();


Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

NickOg

I can't get that to run Max.

				require_once('components/com_u3aV5/common/includes/fnCommon.php');
require_once('components/com_u3aV5/common/includes/fnCommonV6.php');
require_once('components/com_u3aV5/common/includes/fnCCCommon.php');
require_once('components/com_u3aV5/membership/includes/fnMemberEditorApp.php');
$connection = $this->_connection();

Comes up with
				0 - Call to undefined method G2\L\View::_connection()
				

admin

Hi Nick,

Apologies, you should actually use this code:

				$connection = $this->Parser->_connection();
				


Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!

NickOg

Thanks Max - that fixed it. Are there any other useful methods it would be handy to know about?

Regards
Nick

admin

Hi Nick,

Please check the FAQs section on Chronoforms 6 and Connectivity 6

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!