Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

Porting GroupJive CBE-Tab to CB Plugin

  • mischa
  • mischa
  • OFFLINE
  • Posts: 15
  • Thanks: 0
  • Karma: 7
18 years 2 months ago #20172 by mischa
Hi there ppl,


Since a while I have discovered GroupJive. Rightnow I'm busy with some bug-fixing and funtion-adding to it because the project nearly died.

Besides this I'm looking to the CB-integration of GroupJive.
Now there's a plugin created by Stiggi that does the job of displaying the groups I'm a member of in a tab in CB. But this is not enough for me.

Phil_K made a tab for CBE (Community Builder Enhanced) once that is looking much better imho and is giving some more overviews. Rightnow I'm trying to port his tab into a CB-plugin because I definately like CB more then CBE.

Now I simply tried to adjust his code to the CB Api and I must say it's working almost... The only issue I'm having is that the tabcontents are now shown not in a tab but flat on the top of my profile. Everything else works ok.

Maybe I am much to positive about the ability of porting a CBE tab into a CB plugin but it's worth trying. I simply added the needed class and the functions that are written down in the CB Api, and putted the CBE-code into the function getDisplayTab. But the info still isn't showing in a tab.


Here's a screenshot of the issue to clarify things more, but I now I have to make some language-definitions (looks ugly rightnow:-)).


I hope someone with some (much) more experience and knowledge wants to take a look at the code to find the missing parts that's causing the plugin to show the data in the top-side of the main profile page instead of a tab...


Many thanks for any help in advance... Any help is much appreciated....;) ;)



Greetz,


Mischa.

Post edited by: mischa, at: 2006/09/04 03:56

Post edited by: mischa, at: 2006/09/10 13:54

Projectmember of the BirthDays Module Project
Attachments:

Please Log in or Create an account to join the conversation.

  • mischa
  • mischa
  • OFFLINE
  • Posts: 15
  • Thanks: 0
  • Karma: 7
18 years 2 months ago #20658 by mischa
Replied by mischa on topic Re:Porting GroupJive CBE-Tab to CB Plugin
Hi there again,


I've been trying to get this to work the last days... Sadly without any better result.

I really don't understand why this thing isn't placing the contents into a tab?? I placed all the code into the tab-functions and still it isn't showing up in a nice tab...:(

I will post the complete code here into code tags so more experienced ppl can take a quick look at it... Hopefully someone is able and willing to (just) put me into the right direction... :unsure:


Here's the code:

[code:1]
<?php
//****************************************************
// GroupJive Tab in Profile By Phil_K *
// Port to CB Native by Mischa *
// *
// 27-02-2006 / 05-09-2006 *
// Released under the GNU/GPL License *
// Version 1.0.1 *
// File date: 27-02-2006 / 05-09-2006 *
//****************************************************

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

class getGroupjiveTab extends cbTabHandler {
/**
* Constructor
*/
function getGroupjiveTab() {
$this->cbTabHandler();
}
/**
* Generates the HTML to display the user profile tab
* @param object tab reflecting the tab database entry
* @param object mosUser reflecting the user being displayed
* @param int 1 for front-end, 2 for back-end
* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
*/
function getDisplayTab($tab,$user,$ui) {


global $database, $userpr, $my;


if ($GLOBALS!='') {
$Itemid_c = $GLOBALS;
} else {
$Itemid_c = '';
}

$func=mosGetParam( $_REQUEST, 'func', 'show_all' );

$database->setQuery("SELECT id FROM #__menu WHERE (link LIKE '%com_groupjive%') AND (published='1' OR published='0') ORDER BY id DESC Limit 1"«»);
$gj_itemid = $database->loadResult();
if ($gj_itemid != '') {
$gj_itemid = "&amp;Itemid=".$gj_itemid;
}

If ($userpr=='' && $user =='') {
$user_g = $my->id;
} else {
$user_g = $user->id;
}

$database->setQuery( "SELECT u.* FROM #__comprofiler c, #__users u WHERE c.id=u.id AND c.id='".$user_g."'"«»);
$users_g = $database->loadObjectList();
$user_g = $users_g[0];



function gj_write_navlinks( $Item_id_c, $option, $uid, $user_g, $submitvalue) {
global $func;

$gj_nav_return = "<div style=\"text-align:center;\"> ";
$gj_nav_return .= "<a href=\"index.php?option=com_comprofiler".$Itemid_c."&amp;task=userProfile&amp;user=".$user_g->id."&amp;func=show_all&amp;index="._UE_GROUPJIVE_TAB_LABEL."\">";
$gj_nav_return .= (($func=='show_all'||$func=='') ? "<b>" : ""«»)._UE_GJ_SHOWALL.(($func=='show_all'||$func=='') ? "</b>" : ""«»)."</a>";
$gj_nav_return .= " - <a href=\"index.php?option=com_comprofiler".$Itemid_c."&amp;task=userProfile&amp;user=".$user_g->id."&amp;func=gj_owned&amp;index="._UE_GROUPJIVE_TAB_LABEL."\">";
$gj_nav_return .= (($func=='gj_owned') ? "<b>" : ""«»)._UE_GJ_SHOWOWNED.(($func=='gj_owned') ? "</b>" : ""«»)."</a>";
$gj_nav_return .= " - <a href=\"index.php?option=com_comprofiler".$Itemid_c."&amp;task=userProfile&amp;user=".$user_g->id."&amp;func=gj_memberof&amp;index="._UE_GROUPJIVE_TAB_LABEL."\">";
$gj_nav_return .= (($func=='gj_memberof') ? "<b>" : ""«»)._UE_GJ_SHOWMEMBEROF.(($func=='gj_memberof') ? "</b>" : ""«»)."</a>";
$gj_nav_return .= "</div> \n";

return $gj_nav_return;
}

function gj_show_owned ( $Item_id_c, $option, $uid, $user_g, $submitvalue ) {
global $database,$my,$gj_itemid;

$gj_own_out ="";

$q_own = 'SELECT a.id, a.name, a.descr, c.catname FROM #__gj_groups a '
.'INNER JOIN #__gj_grcaterory c ON a.category = c.id '
.'WHERE user_id = '.$user_g->id.' ORDER BY id, name';
$database->setQuery($q_own);
$groups=$database->loadObjectList();

$gj_own_out .= "\n<br><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
if ($my->id == $user_g->id) {
$gj_own_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">"._UE_GJTAB_YOU." ";
if (count($groups) < 1) {
$gj_own_out .= _UE_GROUPJIVE_NODATA_O."</td>\n</tr>";
} else {
$gj_own_out .= ((count($groups) > 1) ? _UE_GJTAB_YOWNEROF : _UE_GJTAB_YOWNEROFS)."</td>\n</tr>";
}
} else {
$gj_own_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">".$user_g->username." ";
if (count($groups) < 1) {
$gj_own_out .= _UE_GROUPJIVE_NODATA_O."</td>\n</tr>";
} else {
$gj_own_out .= ((count($groups) > 1) ? _UE_GJTAB_OWNEROF : _UE_GJTAB_OWNEROFS)."</td>\n</tr>";
}
}

$mouseover = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=125;return";

if (count($groups) > 0) {
foreach($groups as $group) {

$gj_info = "escape('".$group->descr."')\"";
$gj_tip = $mouseover." ".$gj_info;

$i= ($i==1) ? 2 : 1;
$gj_own_out .= "\n<tr class=sectiontableentry".$i.">\n";
$gj_own_out .= "<td>";
$gj_own_out .= $group->catname.'</td><td style="white-space:nowrap;">-></td><td '.$gj_tip.'>'.$group->name.'</td>';
if ($my->id != $user_g->id) {
$gj_own_out .= '<td><a href="index.php?option=com_groupjive'.$gj_itemid.'&amp;task=sign&amp;groupid='.$group->id.'">'._UE_GJ_TAB_JOINGROUP.'</a></td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&amp;task=showgroup&amp;groupid='.$group->id.'">'._UE_GJTAB_VIEWGROUP.'</a></td></tr>';
} else {
$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='1' AND id_group='".$group->id."'"«»);
$inac_user = $database->loadResult();
$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='0' AND id_group='".$group->id."'"«»);
$ac_user = $database->loadResult();

$gj_own_out .= '<td><a href="index.php?option=com_groupjive'.$gj_itemid.'&amp;task=showgroup&amp;groupid='.$group->id.'">'.$ac_user.' '._UE_GJTAB_ACTIVE.'</a></td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=inactiveusers&groupid='.$group->id.'">'.$inac_user.' '._UE_GJTAB_INACTIVE.'</a></td></tr>';
}
}
}

$gj_own_out .= '</table>';

return $gj_own_out;

}

function gj_show_memberof ( $Item_id_c, $option, $uid, $user_g, $submitvalue ) {
global $database,$my,$gj_itemid;

$gj_member_out ="";

$q_member = "SELECT a.id, a.name, a.descr, c.catname FROM #__gj_groups a "
."INNER JOIN #__gj_users b ON a.id = b.id_group "
."INNER JOIN #__gj_grcaterory c ON a.category = c.id "
."WHERE id_user = ".$user_g->id." AND b.status='0' "
."ORDER BY a.id, name";
$database->setQuery($q_member);
$groups=$database->loadObjectList();

$gj_member_out .= "\n<br><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
if ($my->id == $user_g->id) {
$gj_member_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">"._UE_GJTAB_YOU." ";
if (count($groups) < 1) {
$gj_member_out .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_member_out .= ((count($groups) > 1) ? _UE_GJTAB_YMEMBEROF : _UE_GJTAB_YMEMBEROFS)."</td>\n</tr>";
}
} else {
$gj_member_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">".$user_g->username." ";
if (count($groups) < 1) {
$gj_member_out .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_member_out .= ((count($groups) > 1) ? _UE_GJTAB_MEMBEROF : _UE_GJTAB_MEMBEROFS)."</td>\n</tr>";
}
}

$mouseover = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=125;return";

if (count($groups) > 0) {
foreach($groups as $group) {

$gj_info = "escape('".$group->descr."')\"";
$gj_tip = $mouseover." ".$gj_info;

$i= ($i==1) ? 2 : 1;
$gj_member_out .= "\n<tr class=sectiontableentry".$i.">\n";
$gj_member_out .= "<td>";
$gj_member_out .= $group->catname.'</td><td style="white-space:nowrap;">-></td><td '.$gj_tip.'>'.$group->name.'</td>';
if ($my->id != $user_g->id) {
$gj_member_out .= '<td><a href="index.php?option=com_groupjive'.$gj_itemid.'&amp;task=sign&amp;groupid='.$group->id.'">'._UE_GJ_TAB_JOINGROUP.'</a></td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&amp;task=showgroup&amp;groupid='.$group->id.'">'._UE_GJTAB_VIEWGROUP.'</a></td></tr>';
} else {
$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='0' AND id_group='".$group->id."'"«»);
$ac_user = $database->loadResult();

$gj_member_out .= '<td>&nbsp;</td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&amp;task=showgroup&amp;groupid='.$group->id.'">'.$ac_user.' '._UE_GJTAB_ACTIVE.'</a></td></tr>';
}
}
}

$gj_member_out .= '</table>';

return $gj_member_out;

}

function gj_show_all ( $Item_id_c, $option, $uid, $user_g, $submitvalue ) {
global $database,$my,$gj_itemid;

$gj_all_return = "";
$gj_all_return .= gj_write_navlinks ( $Item_id_c, $option, $uid, $user_g,$submitvalue );

$q_member = 'SELECT a.id, a.name, a.descr, c.catname, a.user_id as creator_id FROM #__gj_groups a '
.'INNER JOIN #__gj_users b ON a.id = b.id_group '
.'INNER JOIN #__gj_grcaterory c ON a.category = c.id '
.'WHERE id_user = '.$user_g->id.' '
.'ORDER BY a.id, name';
$database->setQuery($q_member);
$groups=$database->loadObjectList();

$gj_all_return .= "\n<br><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
// $gj_all_return .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"6\">".$user_g->username." ".((count($groups) > 1) ? _UE_GJTAB_MEMBEROF : _UE_GJTAB_MEMBEROFS)."</td>\n</tr>";
if ($my->id == $user_g->id) {
$gj_all_return .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"6\">"._UE_GJTAB_YOU." ";
if (count($groups) < 1) {
$gj_all_return .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_all_return .= ((count($groups) > 1) ? _UE_GJTAB_YMEMBEROF : _UE_GJTAB_YMEMBEROFS)."</td>\n</tr>";
}
} else {
$gj_all_return .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"6\">".$user_g->username." ";
if (count($groups) < 1) {
$gj_all_return .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_all_return .= ((count($groups) > 1) ? _UE_GJTAB_MEMBEROF : _UE_GJTAB_MEMBEROFS)."</td>\n</tr>";
}
}

$mouseover = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=125;return";
$mouseover_c = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=60;return";

if (count($groups) > 0) {
foreach($groups as $group) {

$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='0' AND id_group='".$group->id."'"«»);
$ac_user = $database->loadResult();

$gj_info = "escape('".$group->descr."')\"";
$gj_tip = $mouseover." ".$gj_info;

$i= ($i==1) ? 2 : 1;
$gj_all_return .= "\n<tr class=sectiontableentry".$i.">\n";
$gj_all_return .= "<td>";
$gj_all_return .= $group->catname.'</td><td style="white-space:nowrap;">-></td><td '.$gj_tip.'>'.$group->name.'</td>';

if ($user_g->id != $group->creator_id) {
$gj_tip_c = $mouseover_c." escape('"._UE_GJ_SHOWMEMBEROF."')\"";
$gj_creator_tag = " <u ".$gj_tip_c.">(M)</u> ";
} else {
$gj_tip_c = $mouseover_c." escape('"._UE_GJ_SHOWOWNED."')\"";
$gj_creator_tag = " <u ".$gj_tip_c.">(C)</u> ";
}

$gj_all_return .= '<td>'.$gj_creator_tag.' </td>';
$gj_all_return .= '<td>'.$ac_user.' '._UE_GJTAB_ACTIVE.'</td>';
$gj_all_return .= '<td><a href="index.php?option=com_groupjive&amp;task=showgroup&amp;groupid='.$group->id.'">'._UE_GJTAB_VIEWGROUP.'</a></td></tr>';
}
}

$gj_all_return .= '</table>';

return $gj_all_return;

}


function gj_show_all_old ( $Item_id_c, $option, $uid, $user_g, $submitvalue ) {
global $database;

$gj_all_return = "";
$gj_all_return .= gj_write_navlinks ( $Item_id_c, $option, $uid, $user_g, $submitvalue );
$gj_all_return .= gj_show_owned ( $Item_id_c, $option, $uid, $user_g, $submitvalue );
$gj_all_return .= "<br> \n";
$gj_all_return .= gj_show_memberof ( $Item_id_c, $option, $uid, $user_g, $submitvalue );

echo $gj_all_return;

}

switch ($func) {

case "show_all":
echo gj_show_all( $Item_id_c, $option, $my->id, $user_g, _UE_UPDATE);
break;

// for testing
case "show_oll":
echo gj_show_all_old( $Item_id_c, $option, $my->id, $user_g, _UE_UPDATE);
break;

case "gj_owned":
echo gj_write_navlinks( $Item_id_c, $option, $uid, $user_g, $submitvalue);
echo gj_show_owned( $Item_id_c, $option, $my->id, $user_g, _UE_UPDATE);
break;

case "gj_memberof":
echo gj_write_navlinks( $Item_id_c, $option, $uid, $user_g, $submitvalue);
echo gj_show_memberof( $Item_id_c, $option, $my->id, $user_g, _UE_UPDATE);
break;

default:
echo gj_show_all( $Item_id_c, $option, $my->id, $user_g, _UE_UPDATE);
break;

}

} // end function getDisplayTab

} // end class getGroupjiveTab.
?>
[/code:1]



Many thanks for all the possible help... I'd really appreciate any directors....



Greetings,


Mischa.

Projectmember of the BirthDays Module Project

Please Log in or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
18 years 2 months ago #20661 by nant
At first glance you shouldnt be using echo to display things.
You should create html and return it at the end of the gettabdisplay function.

Study some of the core tabs to see the proper method.

Post edited by: nant, at: 2006/09/10 14:54

Please Log in or Create an account to join the conversation.

  • mischa
  • mischa
  • OFFLINE
  • Posts: 15
  • Thanks: 0
  • Karma: 7
18 years 2 months ago #20692 by mischa
Replied by mischa on topic Re:Porting GroupJive CBE-Tab to CB Plugin
Hi there again,


Thanks for your reply Nant... It's really appriciated...


To be ontopic:P:

Thanks for pointing me in the right direction... It looks like it's going to be a little bit more difficult then I had suspected... Just my problem, I miss the knowledge...:(

Upcoming weeks I will use the www-library to learn more about those return-statements... Now they are pretty vague to me...:ohmy: Although besides this knowledge-problem I just used my own brain (I hope they worked..) to adjust the code with the help and tips from Nant... It now looks like this:

[code:1]
<?php
//****************************************************
// GroupJive Tab in Profile By Phil_K *
// Port to CB Native by Mischa *
// *
// 27-02-2006 / 05-09-2006 / 11-09-2006 *
// Released under the GNU/GPL License *
// Version 1.0.1 *
// File date: 27-02-2006 / 05-09-2006 / 11-09-2006 *
//****************************************************

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

class getGroupjiveTab extends cbTabHandler {
/**
* Constructor
*/
function getGroupjiveTab() {
$this->cbTabHandler();
}
/**
* Generates the HTML to display the user profile tab
* @param object tab reflecting the tab database entry
* @param object mosUser reflecting the user being displayed
* @param int 1 for front-end, 2 for back-end
* @returns mixed : either string HTML for tab content, or false if ErrorMSG generated
*/
function getDisplayTab($tab,$user,$ui) {


global $database, $userpr, $my;


if ($GLOBALS!='') {
$Itemid_c = $GLOBALS;
} else {
$Itemid_c = '';
}

$func=mosGetParam( $_REQUEST, 'func', 'show_all' );

$database->setQuery("SELECT id FROM #__menu WHERE (link LIKE '%com_groupjive%') AND (published='1' OR published='0') ORDER BY id DESC Limit 1"«»);
$gj_itemid = $database->loadResult();
if ($gj_itemid != '') {
$gj_itemid = "&Itemid=".$gj_itemid;
}

If ($userpr=='' && $user =='') {
$user_g = $my->id;
} else {
$user_g = $user->id;
}

$database->setQuery( "SELECT u.* FROM #__comprofiler c, #__users u WHERE c.id=u.id AND c.id='".$user_g."'"«»);
$users_g = $database->loadObjectList();
$user_g = $users_g[0];


function gj_write_navlinks( $Item_id_c, $option, $uid, $user_g, $submitvalue) {
global $func;

$gj_nav_return = "<div style=\"text-align:center;\"> ";
$gj_nav_return .= "<a href=\"index.php?option=com_comprofiler".$Itemid_c."&task=userProfile&user=".$user_g->id."&func=show_all&index="._UE_GROUPJIVE_TAB_LABEL."\">";
$gj_nav_return .= (($func=='show_all'||$func=='') ? "<b>" : ""«»)._UE_GJ_SHOWALL.(($func=='show_all'||$func=='') ? "</b>" : ""«»)."</a>";
$gj_nav_return .= " - <a href=\"index.php?option=com_comprofiler".$Itemid_c."&task=userProfile&user=".$user_g->id."&func=gj_owned&index="._UE_GROUPJIVE_TAB_LABEL."\">";
$gj_nav_return .= (($func=='gj_owned') ? "<b>" : ""«»)._UE_GJ_SHOWOWNED.(($func=='gj_owned') ? "</b>" : ""«»)."</a>";
$gj_nav_return .= " - <a href=\"index.php?option=com_comprofiler".$Itemid_c."&task=userProfile&user=".$user_g->id."&func=gj_memberof&index="._UE_GROUPJIVE_TAB_LABEL."\">";
$gj_nav_return .= (($func=='gj_memberof') ? "<b>" : ""«»)._UE_GJ_SHOWMEMBEROF.(($func=='gj_memberof') ? "</b>" : ""«»)."</a>";
$gj_nav_return .= "</div> \n";

return $gj_nav_return;
}

function gj_show_owned ( $Item_id_c, $option, $uid, $user_g, $submitvalue ) {
global $database,$my,$gj_itemid;

$gj_own_out ="";

$q_own = 'SELECT a.id, a.name, a.descr, c.catname FROM #__gj_groups a '
.'INNER JOIN #__gj_grcaterory c ON a.category = c.id '
.'WHERE user_id = '.$user_g->id.' ORDER BY id, name';
$database->setQuery($q_own);
$groups=$database->loadObjectList();

$gj_own_out .= "\n<br><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
if ($my->id == $user_g->id) {
$gj_own_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">"._UE_GJTAB_YOU." ";
if (count($groups) < 1) {
$gj_own_out .= _UE_GROUPJIVE_NODATA_O."</td>\n</tr>";
} else {
$gj_own_out .= ((count($groups) > 1) ? _UE_GJTAB_YOWNEROF : _UE_GJTAB_YOWNEROFS)."</td>\n</tr>";
}
} else {
$gj_own_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">".$user_g->username." ";
if (count($groups) < 1) {
$gj_own_out .= _UE_GROUPJIVE_NODATA_O."</td>\n</tr>";
} else {
$gj_own_out .= ((count($groups) > 1) ? _UE_GJTAB_OWNEROF : _UE_GJTAB_OWNEROFS)."</td>\n</tr>";
}
}

$mouseover = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=125;return";

if (count($groups) > 0) {
foreach($groups as $group) {

$gj_info = "escape('".$group->descr."')\"";
$gj_tip = $mouseover." ".$gj_info;

$i= ($i==1) ? 2 : 1;
$gj_own_out .= "\n<tr class=sectiontableentry".$i.">\n";
$gj_own_out .= "<td>";
$gj_own_out .= $group->catname.'</td><td style="white-space:nowrap;">-></td><td '.$gj_tip.'>'.$group->name.'</td>';
if ($my->id != $user_g->id) {
$gj_own_out .= '<td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=sign&groupid='.$group->id.'">'._UE_GJ_TAB_JOINGROUP.'</a></td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=showgroup&groupid='.$group->id.'">'._UE_GJTAB_VIEWGROUP.'</a></td></tr>';
} else {
$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='1' AND id_group='".$group->id."'"«»);
$inac_user = $database->loadResult();
$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='0' AND id_group='".$group->id."'"«»);
$ac_user = $database->loadResult();

$gj_own_out .= '<td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=showgroup&groupid='.$group->id.'">'.$ac_user.' '._UE_GJTAB_ACTIVE.'</a></td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=inactiveusers&groupid='.$group->id.'">'.$inac_user.' '._UE_GJTAB_INACTIVE.'</a></td></tr>';
}
}
}

$gj_own_out .= '</table>';

return $gj_own_out;

}

function gj_show_memberof ( $Item_id_c, $option, $uid, $user_g, $submitvalue ) {
global $database,$my,$gj_itemid;

$gj_member_out ="";

$q_member = "SELECT a.id, a.name, a.descr, c.catname FROM #__gj_groups a "
."INNER JOIN #__gj_users b ON a.id = b.id_group "
."INNER JOIN #__gj_grcaterory c ON a.category = c.id "
."WHERE id_user = ".$user_g->id." AND b.status='0' "
."ORDER BY a.id, name";
$database->setQuery($q_member);
$groups=$database->loadObjectList();

$gj_member_out .= "\n<br><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
if ($my->id == $user_g->id) {
$gj_member_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">"._UE_GJTAB_YOU." ";
if (count($groups) < 1) {
$gj_member_out .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_member_out .= ((count($groups) > 1) ? _UE_GJTAB_YMEMBEROF : _UE_GJTAB_YMEMBEROFS)."</td>\n</tr>";
}
} else {
$gj_member_out .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"5\">".$user_g->username." ";
if (count($groups) < 1) {
$gj_member_out .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_member_out .= ((count($groups) > 1) ? _UE_GJTAB_MEMBEROF : _UE_GJTAB_MEMBEROFS)."</td>\n</tr>";
}
}

$mouseover = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=125;return";

if (count($groups) > 0) {
foreach($groups as $group) {

$gj_info = "escape('".$group->descr."')\"";
$gj_tip = $mouseover." ".$gj_info;

$i= ($i==1) ? 2 : 1;
$gj_member_out .= "\n<tr class=sectiontableentry".$i.">\n";
$gj_member_out .= "<td>";
$gj_member_out .= $group->catname.'</td><td style="white-space:nowrap;">-></td><td '.$gj_tip.'>'.$group->name.'</td>';
if ($my->id != $user_g->id) {
$gj_member_out .= '<td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=sign&groupid='.$group->id.'">'._UE_GJ_TAB_JOINGROUP.'</a></td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=showgroup&groupid='.$group->id.'">'._UE_GJTAB_VIEWGROUP.'</a></td></tr>';
} else {
$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='0' AND id_group='".$group->id."'"«»);
$ac_user = $database->loadResult();

$gj_member_out .= '<td> </td><td><a href="index.php?option=com_groupjive'.$gj_itemid.'&task=showgroup&groupid='.$group->id.'">'.$ac_user.' '._UE_GJTAB_ACTIVE.'</a></td></tr>';
}
}
}

$gj_member_out .= '</table>';

return $gj_member_out;

}

function gj_show_all ( $Item_id_c, $option, $uid, $user_g, $submitvalue ) {
global $database,$my,$gj_itemid;

$gj_all_return = "";
$gj_all_return .= gj_write_navlinks ( $Item_id_c, $option, $uid, $user_g,$submitvalue );

$q_member = 'SELECT a.id, a.name, a.descr, c.catname, a.user_id as creator_id FROM #__gj_groups a '
.'INNER JOIN #__gj_users b ON a.id = b.id_group '
.'INNER JOIN #__gj_grcaterory c ON a.category = c.id '
.'WHERE id_user = '.$user_g->id.' '
.'ORDER BY a.id, name';
$database->setQuery($q_member);
$groups=$database->loadObjectList();

$gj_all_return .= "\n<br><table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
// $gj_all_return .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"6\">".$user_g->username." ".((count($groups) > 1) ? _UE_GJTAB_MEMBEROF : _UE_GJTAB_MEMBEROFS)."</td>\n</tr>";
if ($my->id == $user_g->id) {
$gj_all_return .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"6\">"._UE_GJTAB_YOU." ";
if (count($groups) < 1) {
$gj_all_return .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_all_return .= ((count($groups) > 1) ? _UE_GJTAB_YMEMBEROF : _UE_GJTAB_YMEMBEROFS)."</td>\n</tr>";
}
} else {
$gj_all_return .= "\n<tr>\n<td align=left align=center class=\"sectiontableheader\" colspan=\"6\">".$user_g->username." ";
if (count($groups) < 1) {
$gj_all_return .= _UE_GROUPJIVE_NODATA_M."</td>\n</tr>";
} else {
$gj_all_return .= ((count($groups) > 1) ? _UE_GJTAB_MEMBEROF : _UE_GJTAB_MEMBEROFS)."</td>\n</tr>";
}
}

$mouseover = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=125;return";
$mouseover_c = "onmouseover=\"this.T_LEFT=true;this.T_WIDTH=60;return";

if (count($groups) > 0) {
foreach($groups as $group) {

$database->setQuery("SELECT COUNT(id) FROM #__gj_users WHERE status='0' AND id_group='".$group->id."'"«»);
$ac_user = $database->loadResult();

$gj_info = "escape('".$group->descr."')\"";
$gj_tip = $mouseover." ".$gj_info;

$i= ($i==1) ? 2 : 1;
$gj_all_return .= "\n<tr class=sectiontableentry".$i.">\n";
$gj_all_return .= "<td>";
$gj_all_return .= $group->catname.'</td><td style="white-space:nowrap;">-></td><td '.$gj_tip.'>'.$group->name.'</td>';

if ($user_g->id != $group->creator_id) {
$gj_tip_c = $mouseover_c." escape('"._UE_GJ_SHOWMEMBEROF."')\"";
$gj_creator_tag = " <u ".$gj_tip_c.">(M)</u> ";
} else {
$gj_tip_c = $mouseover_c." escape('"._UE_GJ_SHOWOWNED."')\"";
$gj_creator_tag = " <u ".$gj_tip_c.">(C)</u> ";
}

$gj_all_return .= '<td>'.$gj_creator_tag.' </td>';
$gj_all_return .= '<td>'.$ac_user.' '._UE_GJTAB_ACTIVE.'</td>';
$gj_all_return .= '<td><a href="index.php?option=com_groupjive&task=showgroup&groupid='.$group->id.'">'._UE_GJTAB_VIEWGROUP.'</a></td></tr>';
}
}

$gj_all_return .= '</table>';

return $gj_all_return;

}



if ($func="show_all"«»)
{
return $gj_all_return;
}
elseif ($func="gj_owned"«»)
{
return $gj_nav_return;
return $gj_own_out;
}
elseif ($func="gj_memberof"«»)
{
return $gj_nav_return;
return $gj_member_out;
}
else
{
return $gj_all_return;
}

} // end function getDisplayTab

} // end class getGroupjiveTab.
?>
[/code:1]


I guess that this should be the way to go... I define the functions first. Then I end up with if statements on the $func variable, that if chosen should write the, in the function defined html, into the tab-contents....

This just sound logical to me... Although I think it's not quite good because when using this code the tab doesn't show up at all...:pinch: :silly: :P


I am gonna read some good books about this stuff... I have to cover up my skills very hard before I'm able to solve this thing I guess...


I put "this tiny side-project" on hold untill I have the good skills for it....



Thanks for the help.... All tips are offcourse still welcome...;) But I really have to learn on my own I think...B)


Greetz,

Mischa
(in college for a while..:P)

Post edited by: mischa, at: 2006/09/11 01:48

Post edited by: mischa, at: 2006/09/11 01:49

Projectmember of the BirthDays Module Project

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum