Forums: PHPRunner and Joomla - Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

PHPRunner and Joomla how to integrate PHPRunner application into Joomla website

#1 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8534
  • Joined: 03-February 03

Posted 02 December 2009 - 05:33 AM

This article explains how to integrate PHPRunner 5.1 with Joomla 1.5.15. It should work the same way with other versions of PHPRunner and Joomla.

The key to PHPRunner/Joomla integration is to display PHPRunner app in iframe. There are at least two ways to do so. We'll walk through both, step by step.


1. Wrapper extension (com_wrapper).

Copy components/com_wrapper/views/wrapper/tmpl/default.php to templates/<your_template_here>/html/com_wrapper/wrapper/default.php. Default template in Joomla 1.5 is 'rhuk_milkyway' so you need to copy default.php to templates/rhuk_milkyway/html/com_wrapper/wrapper folder.

Modify com_wrapper/views/wrapper/tmpl/default.php the following way (see changes in bold).

We retrieve the current session id and pass it to PHPRunner application via URL.

Quote

defined('_JEXEC') or die('Restricted access');
$session =& JFactory::getSession();
$sid = $session->getId();

?>

...
name="iframe"
src="<?php echo $this->wrapper->url . "?sessionid=$sid"; ?>"
width="<?php echo $this->params->get( 'width' ); ?>"
...


Once you made this change create a new menu item in Joomla choosing Wrapper as a menu item type. Enter your application URL as a Wrapper URL. Make sure URL points to PHP page i.e. http://localhost/joo...rscars_list.php or http://localhost/joo...unner/menu.php.

It doesn't really matter where PHPRunner application is located, just make sure it uses the same database as Joomla does.

2. Wrapper plugin.

Another approach is to use iframe plugin.

We'll need to implement a similar change in plugins/content/plg_iframe.php file. See changes in bold.

Quote

...
defined( '_JEXEC' ) or die();
$session =& JFactory::getSession();
$sid = $session->getId();


jimport( 'joomla.event.plugin' );

...

$params0['src'] = (@$params0['src'])? $params0['src']."?sessionid=$sid":$this->params->get( 'src', 'http://www.luyenkim.net' );
if($url !='') {
...



Now you can insert the following in any article:

Quote

{iframe width="600" height="500" align="top"}http://localhost/joo...runner/menu.php{/iframe}



You can use any of methods above or even both methods together.

3. Add Joomla sessions support to PHPRunner application

Now we need to make PHPRunner application understand Joomla session id.

Add the following code to 'After application initialized' event.


$jconn=db_connect();

// Get sessionvariable of Joomla-Session over the URL which passes the Joomla-Wrapper to the iframe
if (@$_GET["sessionid"])
  $_SESSION["sessionid"] = @$_GET["sessionid"]; 

if (@$_SESSION["sessionid"])
{

//Get the values out of the jos-session-table:

$rs=db_query("select * from `jos_session` where session_id='" . $_SESSION["sessionid"]. "'",$jconn);
$data=db_fetch_array($rs);
if($data)
// log in
{
	$_SESSION["UserID"] = $data["username"];
	$_SESSION["GroupID"] = $data["usertype"];
	if ($data["gid"]>=24)
		$_SESSION["AccessLevel"] = ACCESS_LEVEL_ADMINGROUP;
	else
		$_SESSION["AccessLevel"] = ACCESS_LEVEL_USER;
}
else 
// log out
{
	$_SESSION["UserID"] = "";
  	$_SESSION["AccessLevel"] = "";
	$_SESSION["GroupID"] = "";
}

}


This will logon you to PHPRunner application automatically. It will log out you automatically as well.

If your PHPRunner applications uses advanced security options or AfterSuccessfulLogin event you need to copy some code from login.php to 'After application initialized' event.


Open login.php file in any text editor and find the following section:

        if($logged)
        {
                $_SESSION["UserID"] = $pUsername;
                $_SESSION["AccessLevel"] = ACCESS_LEVEL_USER;

                ...

                if($myurl)
                        header("Location: ".$myurl);
                else
                        header("Location: ".$defaulturl);
                return;

        }



Select and copy everything between $_SESSION["AccessLevel"] = ACCESS_LEVEL_USER; and if($myurl)
Paste it to the end of 'After application initialized' event;


4. Static permissions

You may want to use Joomla's user groups. For this purpose turn on User Group Permissions in PHPRunner and create one or more groups named after Joomla usergroups.

Super Administrator
Administrator
Manager
Publisher
Editor
Author
Registered

5. Further considerations

- dynamic permissions

It is possible to make Joomla/PHPRunner work with dynamic permissions though it requires some code changes in PHPRunner. Technically speaking we'll need to modify admin area to read a list of groups from jos_core_acl_aro_groups table and disable 'user management' and 'assign users to groups' pages. We'll implement this in one of the following versions.


Here is how it looks in action
Posted Image


Update

According to number of votes we received via email here is the list of what we should implement next.

Drupal
Wordpress
Typo3
http://www.cmsmadesimple.org/
xoops.org
X-site Pro 2
http://www.concrete5.org/
redaxo
SPIP
glfusion
Best regards,
Sergey Kornilov
0

#2 User is offline   runey 

  • Member
  • PipPip
  • Group: Members
  • Posts: 17
  • Joined: 22-October 06

Posted 02 December 2009 - 11:50 PM

Excellent to see a tutorial for integration with Joomla :)

Something you might want to include though is you do not need to modify the com_wrapper itself... It can be done as a template override... That way you don't have to worry about the mod getting overridden when you update Joomla...

Simply copy components/com_wrapper/views/wrapper/tmpl/default.php to templates/<your_template_here>/html/com_wrapper/wrapper/

Make the changes as described to that file instead of the original... Joomla will use that copy and the original core file can remain unchanged...

Unfortunately I don't think this will work with the plugin option... However since it is not a core Joomla plugin that really shouldn't be a big deal...
0

#3 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8534
  • Joined: 03-February 03

Posted 03 December 2009 - 04:24 AM

Runey,

thank you, I'll check that and update article accordingly.
Best regards,
Sergey Kornilov
0

#4 User is offline   bfr 

  • Member
  • PipPip
  • Group: Members
  • Posts: 11
  • Joined: 09-April 08

Posted 03 December 2009 - 09:04 AM

View Postadmin, on 03 December 2009 - 04:24 AM, said:

Runey,

thank you, I'll check that and update article accordingly.



Please, PLEASE do a integration module for drupal also!
0

#5 User is offline   hich 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 132
  • Joined: 14-December 08

Posted 03 December 2009 - 11:24 AM

I am a fan of Joomla as well but had to switch to ASPRunner.
Any chance we get a module to integrate with an ASP based open source CMS system? (i.e Umbraco . A full list can be found here http://www.cmsmatrix.org/matrix )

It's great to see CMS features integrated with PHPRunner/ASPRunner and would avoid having to duplicate efforts to build CMS features in ASPR
PHPR/ASPR development team might ne better suited to choose a couple of CMS to integrate to, may be reuse teplates, use CMS access groups like for joomla, integrate to other modules of the CMS etc...
Although it looks like ASPR/PHPR has the potential to become a CMS itself....with much moe features on top

Great effort and thanks Sergey for this article.

Hich


0

#6 User is offline   dsaunier 

  • Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 24-March 06

Posted 03 December 2009 - 05:20 PM

"What is the next CMS we should integrate with?"

Wordpress no doubt ! That would be amazing.
Any other supporters ?

Thanks.
0

#7 User is offline   salus1 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 39
  • Joined: 01-May 09

Posted 03 December 2009 - 09:43 PM

There are a number of iframe plug-ins available which make it very easy to implement PHPRunner or ASPRunner solutions into WodPress sites...
0

#8 User is offline   mlapl1 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 40
  • Joined: 19-March 09

Posted 09 December 2009 - 01:44 PM

Hello

for new integrations, I suggest drupal (of course) but also glfusion which is very nice indeed.

Cheers
Andrew
0

#9 User is offline   khatazm 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 23-February 09
  • Gender:Male
  • Location:Tehran

Posted 16 December 2009 - 08:52 AM

Thanks you very much for this article .
but I have a question :
you written : Add the following code to 'After application initialized' event.
But I cant find 'After application initialized' event.
Please explain me were is this event and were can I paste that codes.
Best Regards
Kharazm
0

#10 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8534
  • Joined: 03-February 03

Posted 16 December 2009 - 05:15 PM

You can find it on Events screen in PHPRunner.
Best regards,
Sergey Kornilov
0

#11 User is offline   biotechsun 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 16-December 09

Post icon  Posted 16 December 2009 - 07:30 PM

Dear Admin
thanks for the joomla integration and we require the advanced security settings, login events etc to be activated through joomla login. can you please explain what code from login.php to be pasted where?
thanks in advance
it will be a real help.
regards
0

#12 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 8534
  • Joined: 03-February 03

Posted 30 December 2009 - 08:59 PM

Open login.php file in any text editor and find the following section:

	if($logged)
	{
		$_SESSION["UserID"] = $pUsername;
   		$_SESSION["AccessLevel"] = ACCESS_LEVEL_USER;

                ...

		if($myurl)
			header("Location: ".$myurl);
		else
			header("Location: ".$defaulturl);
		return;

   	}


Select and copy everything between $_SESSION["AccessLevel"] = ACCESS_LEVEL_USER; and if($myurl)
Paste it to the end of 'After application initialized' event;
Best regards,
Sergey Kornilov
0

#13 User is offline   jwoker 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 72
  • Joined: 27-June 05

Posted 02 February 2010 - 06:51 PM

Putting Moodle on the horizon would be nice.
0

#14 User is offline   dsaunier 

  • Member
  • PipPip
  • Group: Members
  • Posts: 20
  • Joined: 24-March 06

Posted 19 March 2010 - 05:45 PM

View Postsalus1, on 03 December 2009 - 09:43 PM, said:

There are a number of iframe plug-ins available which make it very easy to implement PHPRunner or ASPRunner solutions into WodPress sites...


Hi,
I missed that reply it seems. Did you successfully manage to integrate a phprunner-generated form into a wordpress site, and if so by using which plugin or method exactly ?

Thanks for the help !
0

#15 User is offline   Eric O 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 23-March 10

Posted 23 March 2010 - 03:30 PM

Quote

According to number of votes we received via email here is the list of what we should implement next.


I'll add another vote for Drupal!
0

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users