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 (Moderator: Donald Lobo) »
  • function get eventTypeName
Pages: [1]

Author Topic: function get eventTypeName  (Read 1581 times)

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
function get eventTypeName
April 28, 2008, 01:49:22 pm
Hi,

I'm using the api to bring back a listing of events in an array based on an event_type_id. However, I want to also just return the event type name based on the id. Is there a simple function I can call to return event type name? Thanks,
emily

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: function get eventTypeName
April 28, 2008, 01:53:35 pm
Similarly, is there a function that will return event_type_id based on the event type name?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: function get eventTypeName
April 28, 2008, 03:29:16 pm
Code: [Select]
        require_once 'CRM/Core/OptionGroup.php';
        $event = CRM_Core_OptionGroup::values('event_type');
        $eventName = CRM_Core_OptionGroup::getLabel( 'event_type', $eventID );
        $eventID     = CRM_Core_OptionGroup::getValue( 'event_type', $eventName );

lobo

P.S> edited the post after i read your message again :)
« Last Edit: April 28, 2008, 03:35:59 pm by Donald Lobo »
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: function get eventTypeName
April 29, 2008, 09:09:19 am
Thanks, Lobo. Exactly what I need as usual.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • function get eventTypeName

This forum was archived on 2017-11-26.