CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • civicrm_tabs hook
Pages: [1]

Author Topic: civicrm_tabs hook  (Read 1450 times)

natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
civicrm_tabs hook
February 21, 2010, 08:21:16 pm
Hi,

I have enabled the following script in the tabs hook to hide tabs based on a command passed by the url.

I was hoping to also set the focus onto a tab, if possible. Can someone point me in the right direction?

at the moment, if the $SourceCommand is Activities, then the Summary and the Activities tabs are the only ones that show and I only want to see the Activities tab. I cannot find a way to hide the Summary tab, so think that if i can set the focus, this should suit our needs...

Thanks in advance!

Nat.


      if ( $SourceProfile == 'Edit' ) {
         if ( $SourceCommand == 'Activities' ) {
            unset( $tabs[1] );
            unset( $tabs[2] );
            unset( $tabs[3] );
            unset( $tabs[5] );
            unset( $tabs[6] );
            unset( $tabs[7] );
            unset( $tabs[8] );
            unset( $tabs[9] );
            unset( $tabs[10] );
            unset( $tabs[11] );
            unset( $tabs[0] );
                     
         }
         if ( $SourceCommand == 'Contributions' ) {
            unset( $tabs[2] );
            unset( $tabs[3] );
            unset( $tabs[4] );
            unset( $tabs[5] );
            unset( $tabs[6] );
            unset( $tabs[7] );
            unset( $tabs[8] );
            unset( $tabs[9] );
            unset( $tabs[10] );
            unset( $tabs[11] );
            unset( $tabs[0] );

}


xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civicrm_tabs hook
February 22, 2010, 03:52:40 am
WHat is $tabs looking like now when your print_r it ?

If you're on drupal, Might be easier otherwise to use view to display only activities ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

natalievl

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: civicrm_tabs hook
February 22, 2010, 01:11:25 pm
Thanks for your response, Xavier.

print_r( $tabs );       results in:
Array ( [4] => Array ( [id] => activity [url] => /civicrm/contact/view/activity?reset=1&snippet=1&cid=3782 [title] => Activities [weight] => 40 ) )

We are operating on a Drupal platform. How do i use view to display only activities?

Cheers,

N.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civicrm_tabs hook
February 22, 2010, 01:26:25 pm
If you want to call the api
http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
and more specifically:
http://wiki.civicrm.org/confluence/display/CRMDOC/Activity+APIs

I tend to write a couple of lines of php to expose the list of activities in a new modules. I find it easier and more performant than view, and therefore I haven't used that much view, but if you activate the civicrm view module, you are getting access to quite a few type of content (contacts...) and quite sure activities as well, but not 100% sure.

I've tried the view module about half an hour. By clicking randomly among the zillion stuff that are offered on the screen, you can get the list of civicrm stuff that you can display, and with a view zillion more clicks and drag and drop, you might quite easily get the list you want. Or alternatively, a pink rabbit will dance for you while you hear "as time goes by".

Bottom line: help ! Someone actually liking the view module could come and explain ?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: civicrm_tabs hook
February 22, 2010, 09:20:00 pm
If i understand the question - in views you create a view that is "displaying items of type CiviCRM Activities" - then you can use Relationship to specify if you are wanting to expose information related to the 'assignee' or the 'target' or the 'assigner'.

You then use Filters to eg limit the results to just Activities of a particular kind etc.

Beware the multiple results that come through if you don't set eg Phone or Email to Primary - but also beware that if you do this then you will filter out those who have no email/phone.

But fwiw I was trying to get Views to expose Custom Data that is set up for Activities and I can't access any Custom Data other than for Contacts - so maybe part of the puzzle is still missing.

Will try and chase jim for some input.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: civicrm_tabs hook
February 23, 2010, 12:59:35 am
@Pete, Great, thanks.

To go back, If this is about displaying a simple list of activities and you have limited knowledge of php, try writing a custom module that display the list of activities (you fetch it using the API).

If you don't have php knowledge but some knowledge of smarty/civicrm, create a profile that displays the name of the contact, create a custom template for it,  add at the bottom a

{crmAPI entity='activity' action="search" var="activities" contact_id=$cid}
<ul>
{foreach from=$activities item=activity}
<li id="activity_{$activity.id}">{$activity.name}</li>
{/foreach}</ul>


(The name for variables is almost certainely wrong, I personally use the Ajax interface on the rest api to figure them out and test)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • civicrm_tabs hook

This forum was archived on 2017-11-26.