Skip to content

Commit

Permalink
Adding first cut of updated JomSocial plugin to 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits committed Jun 26, 2014
1 parent ca22c10 commit 31d9901
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ plugins/fabrik_list/php/scripts/
!plugins/fabrik_cron/
!plugins/fabrik_validationrule/
!plugins/fabrik_visualization/
plugins/community/*
!plugins/community/fabrik/
!tttplugins/system/fabrikcron/
robots.txt
Expand Down
102 changes: 102 additions & 0 deletions plugins/community/fabrik/fabrik.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

/**
* @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved!
* @license http://www.azrul.com Copyrighted Commercial Software
*/

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

require_once( JPATH_ROOT .'/components/com_community/libraries/core.php');

class plgCommunityFabrik extends CApplications
{
var $name = "Fabrik for JomSocial";
var $_name = 'fabrik';
var $_path = '';
var $_user = '';
var $_my = '';


function onProfileDisplay()
{
$config =& CFactory::getConfig();
$this->loadUserParams();

$uri = JURI::base();
$user = CFactory::getActiveProfile();
$document =& JFactory::getDocument();
$css = $uri .'plugins/community/groups/style.css';
$document->addStyleSheet($css);

$view = $this->params->get('fabrik_view');
$id = $this->params->get('fabrik_view_id');
$rowid = $this->params->get('fabrik_row_id');
$usekey = $this->params->get('fabrik_usekey');
$layout = $this->params->get('fabrik_layout');
$additional = $this->params->get('fabrik_additional');
$element = $this->params->get('fabrik_element');

if( !empty($view) && !empty($id) ) {
$cache =& JFactory::getCache('plgCommunityFabrik');
$cache->setCaching($this->params->get('cache', 1));
$callback = array('plgCommunityFabrik', '_getFabrikHTML');

$content = $cache->call($callback, $view, $id, $rowid, $usekey, $layout, $element, $additional, $this->userparams, $user->id);
}else{
$content = "<div class=\"icon-nopost\"><img src='".JURI::base()."components/com_community/assets/error.gif' alt=\"\" /></div>";
$content .= "<div class=\"content-nopost\">".JText::_('Fabrik view details not set.')."</div>";
}

return $content;
}

function _getFabrikHTML($view, $id, $rowid, $usekey, $layout, $element, $additional, &$params, $userId) {
require_once( JPATH_BASE.DS.'plugins'.DS.'community'.DS.'fabrik'.DS.'api_class.php');
$jsFabrik = new jsFabrik();
$plugin_cmd = '';
switch ($view) {
case 'form':
case 'details':
if (empty($rowid) || $rowid == '-2') {
$rowid = $userId;
}
$usekey = (empty($usekey)) ? '' : " usekey=$usekey";
$plugin_cmd = "fabrik view=$view id=$id rowid=$rowid$usekey";
break;
case 'table':
$plugin_cmd = "fabrik view=$view id=$id profileid=$userId";
break;
case 'visualization':
$plugin_cmd = "fabrik view=$view id=$id profileid=$userId";
break;
case 'element':
if (empty($rowid) || $rowid == '-2') {
$rowid = $userId;
}
$usekey = (empty($usekey)) ? '' : " usekey=$usekey";
$plugin_cmd = "fabrik view=$view table=$id row=$rowid$usekey element=$element";
break;
default:
return 'no such view!';
break;
}
if (!empty($layout)) {
$plugin_cmd .= " layout=$layout";
}
if (!empty($additional)) {
$additionals = array();
foreach(explode(' ',$additional) as $keyval) {
list($key,$val) = explode('=',$keyval);
if ($val == '-2') {
$val = $userId;
}
$additionals[] = "$key=$val";
}
$plugin_cmd .= " " . implode(' ',$additionals);
}
//echo $plugin_cmd;
return $jsFabrik->jsFabrikRender(array("{$plugin_cmd}"));
}
}
72 changes: 72 additions & 0 deletions plugins/community/fabrik/fabrik.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="community" method="upgrade">
<name>Fabrik for JomSocial</name>
<author>Hugh Messenger</author>
<creationDate>27 May 2014</creationDate>
<copyright>Copyright (C) 2014. All rights reserved.</copyright>
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>fabrikar.com</authorUrl>
<version>3.2.0.5</version>
<isapplication>true</isapplication>
<isbrowseable>true</isbrowseable>
<description>
Fabrik integration for JomSocial
</description>
<files>
<file plugin="fabrik">fabrik.php</file>
<folder>fabrik</folder>
</files>

<menuitem>
<menu label="Groups" position="toolbar">
<link label="Groups">task=groups</link>
</menu>
</menuitem>

<params>
<param name="cache" type="list" default="0" label="Enable caching" description="Cache data">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="coreapp" type="list" default="0" label="Core Application" description="Causes this application to not appearin the users applications list but it will allow this application to appear in the user profile automatically if selected.">
<option value="0">No</option>
<option value="1">Yes</option>
</param>
<param name="fabrik_view" type="list" default="0" label="Fabrik View type" description="Fabrik View type">
<option value="0">Please select...</option>
<option value="form">Form</option>
<option value="details">Details</option>
<option value="table">Table</option>
<option value="visualization">Visualization</option>
<option value="element">Element</option>
</param>
<param name="fabrik_view_id" type="text" default="" label="View ID" description="Numeric Fabrik table, form or visualization ID" />
<param name="fabrik_row_id" type="Text" default="" label="Row ID" description="Numeric Fabrik rowid, if using Form or Details view. Set to -1 for logged on userid, or -2 for userid of profile being viewed" />
<param name="fabrik_usekey" type="Text" default="" label="Usekey" description="Fabrik element name containing userid to use as search key if using rowid -1 or -2" />
<param name="fabrik_layout" type="Text" default="" label="Layout" description="Fabrik layout to use (optional)" />
<param name="fabrik_element" type="Text" default="" label="Element" description="If using Element view, full element name to show." />
<param name="fabrik_additional" type="Text" default="" label="Additional" description="Additional plugin parameters, such as element filters like table___element=foo, in a space separated list" />
</params>

<config>
<fields name="params" addfieldpath="/administrator/components/com_community/libraries/fields">
<fieldset name="basic">
<field name="coreapp" type="list" default="0" label="Core Application" description="Causes this application to not appearin the users applications list but it will allow this application to appear in the user profile automatically if selected.">
<option value="0">No</option>
<option value="1">Yes</option>
</field>
<field name="cache" type="list" default="1" label="Caching" description="Select whether to cache the content of this plugin">
<option value="1">Use Global</option>
<option value="0">No</option>
</field>
<field name="position" type="list" default="content|sidebar-top|sidebar-bottom" label="Avalaible Positions" description="Select one or more available positions from the list. You can use Ctrl-click to select more than one item.">
<option value="content">Content</option>
<option value="sidebar-top">Sidebar Top</option>
<option value="sidebar-bottom">Sidebar Bottom</option>
</field>
</fieldset>
</fields>
</config>

</extension>
36 changes: 36 additions & 0 deletions plugins/community/fabrik/fabrik/api_class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* @package Joomla
* @subpackage Fabik
* @copyright Copyright (C) 2005 - 2008 Pollen 8 Design Ltd. All rights reserved.
* @license GNU/GPL
*/

// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die();
$defines = JFile::exists(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'user_defines.php') ? JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'user_defines.php' : JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'defines.php';
require_once( $defines );
require_once( JPATH_SITE.DS.'plugins'.DS.'content'.DS.'fabrik.php' );

jimport( 'joomla.plugin.plugin' );

/**
* Fabrik content plugin - renders forms and tables
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/

class jsFabrik extends plgContentFabrik
{
function jsFabrik( )
{
// need to have this func so the default plgContentFabrik constructor doesn't run
}

function jsFabrikRender( $match )
{
return $this->replace( $match );
}
}
3 changes: 3 additions & 0 deletions plugins/community/fabrik/fabrik/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="community">
</extension>
Binary file added plugins/community/fabrik/fabrik/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 31d9901

Please sign in to comment.