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...
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 = "&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;
}
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.