SubMenu on custom php page kicking my behind

I created a page from the BxDolPageView template called chart.php. At the bottom, I have added this:

// Submenu actions
$iId = $client;
$iMemberId = $memberID;

$sTxtProfileAccountPage = _t('_sys_am_profile_account_page');
$sTxtProfileMessage = _t('_sys_am_profile_message');
$sTxtClientAdd = _t('_sys_am_profile_client_add');
$sTxtClientAccept = _t('_sys_am_profile_client_accept');
$sTxtClientCancel = _t('_sys_am_profile_client_cancel');

$aVars = array(
    'ID' => $iId,
    'member_id' => $iMemberId,
    'BaseUri' => BX_DOL_URL_ROOT,
    'cpt_am_profile_account_page' => $sTxtProfileAccountPage
);

if(isClientRequest($iMemberId, $iId)) {
    $aVars['cpt_am_client_add'] = '';
    $aVars['cpt_am_profile_message'] = $sTxtProfileMessage;
} else if(isClientRequest($iId, $iMemberId)) {
    $aVars['cpt_am_client_add'] = '';
    $aVars['cpt_am_client_accept'] = $sTxtClientAccept;
    $aVars['cpt_am_profile_message'] = '';
} else {
    $aVars['cpt_am_client_add'] = $sTxtClientAdd;
    $aVars['cpt_am_client_cancel'] = $sTxtClientCancel;
    $aVars['cpt_am_profile_message'] = $sTxtProfileMessage;
}

$GLOBALS['oTopMenu']->setCustomSubActions($aVars, 'ChartTitle', true);

 

I took that section from the profiles.php page and changed the references from friends to clients. I want it to function exactly the same as the profile page does. If the member is not a client, button displays to add as client and so on.

Next, I went into the sys_objects_actions table, and duplicated all of the entries that were related to friends, and added entries for clients. Also made sure that the new client entries had ChartTitle as type to match my code. But I am still not getting a submenu to show up. I know it is probably something simple, but can someone please help.

Thanks in advance.

caredesign.net
Quote · 21 Apr 2013

This

$GLOBALS['oTopMenu']->setCustomSubActions($aVars, 'ProfileTitle', false);

Doesn't set the sub menu, it just sets action buttons on it. You first need to add the sub menu then only buttons will show. And for that i suppose you need to add a parent element in the menu builder with link "chart.php" and sub items of it with ever you want.

so much to do....
Quote · 21 Apr 2013

OK, I managed to get my buttons, but my functions are not working.

If a member is not an existing client, I do get the add client button, but I cant find the original code:

return $GLOBALS['oTopMenu']->getScriptFriendAdd({ID}, {member_id}, false);

so that I can make a duplicate as:

return $GLOBALS['oTopMenu']->getScriptClientAdd({ID}, {member_id}, false);

 

2nd, If looking at a member who is an existing client, I get both buttons to add them as a client and cancel client request, when I shouldnt be getting any buttons.

caredesign.net
Quote · 21 Apr 2013

Good gracious - I finally managed to get the Addclient button to work, and disappear .

One thing I dont understand - why is it so much code to do so little. Is it just me, or is Dolphin overcoded.

caredesign.net
Quote · 21 Apr 2013

OK, later last night I managed to get everything working, but it is extremely retarded. If I use the same functionality as the friends, I can request to add a member as a client. So I changed the code instead of check = o (meaning pending client acceptance) to a 1( which should make the member automatically a client) It kinda works, but for some reason it keeps throwing the buttons back on the page. But if I leave it as the normal 0 in the code, then it works perfectly. I dont want a user to accept a client request.

So far, it is working I guess the way dolphin is intended to work. Will take some time tonight to figure out how to make it wiork the way I want to. I am guessing it has something to do with the When date. Maybe If I add the date at the same time of the client request with a check of 1, hopefully that will work.

caredesign.net
Quote · 21 Apr 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.