Forums

Show ChronoConnectivity in Module

Stroganoff 04 Aug, 2009
Hi,

I'd like to be able to show a specific database connection in a module, preferably with caching enabled. I already tried to convert "mod_chronocontact" (replacing all classes/variables with their counterparts) but haven't had any luck (always getting "You are not allowed to access this page" in the module) but that was to be expected, because I don't understand the whole of it anyway.

This is my current helper.php:

<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

//load chronoforms classes
require_once( JPATH_SITE.DS.'components'.DS.'com_chronoconnectivity'.DS.'libraries'.DS.'connection.php');
require_once( JPATH_SITE.DS.'components'.DS.'com_chronoconnectivity'.DS.'libraries'.DS.'data.php');
require_once( JPATH_SITE.DS.'components'.DS.'com_chronoconnectivity'.DS.'libraries'.DS.'permissions.php');
require_once( JPATH_SITE.DS.'components'.DS.'com_chronoconnectivity'.DS.'chronoconnectivity.html.php');

class modChronoConnectivityHelper {
	// show online member names
	function getConnection($formname) {
	global $mainframe;
	$database =& JFactory::getDBO();	
	$posted = JRequest::get( 'post' , JREQUEST_ALLOWRAW );
	
	$MyConnection =& CFChronoConnection::getInstance($formname);
	
	$MyConnection->pagetype = 'module';
	$session =& JFactory::getSession();
	$MyConnection->formerrors = $session->get('chrono_form_errors_'.$formname, '', md5('chrono'));
	if($session->get('chrono_form_data_'.$formname, array(), md5('chrono'))){
		$posted = $session->get('chrono_form_data_'.$formname, array(), md5('chrono'));
		//print_r($posted);
	}
	
	$MyConnection->showConnection($formname, $posted);
	}
}
?>


And this is mod_chronoconnectivity.php:
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

// Include the whosonline functions only once
require_once (dirname(__FILE__).DS.'helper.php');

$formname = $params->get( 'chronoformname', '' );
$formcode = modChronoConnectivityHelper::getConnection($formname);


//require(JModuleHelper::getLayoutPath('mod_chronocontact'));

?>


What's missing?
Or is there a simpler way to show some (filtered) records from a database in a module?
GreyHead 05 Aug, 2009
Hi stroganoff,

Looks like a good solution and potentially a useful module, I'll check it out when I have some time.

Bob
This topic is locked and no more replies can be posted.