当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_PseudoConstant::activityType方法代码示例

本文整理汇总了PHP中CRM_Core_PseudoConstant::activityType方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::activityType方法的具体用法?PHP CRM_Core_PseudoConstant::activityType怎么用?PHP CRM_Core_PseudoConstant::activityType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_PseudoConstant的用法示例。


在下文中一共展示了CRM_Core_PseudoConstant::activityType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildForm

 /**
  * @param $form
  */
 function buildForm(&$form)
 {
     /**
      * You can define a custom title for the search form
      */
     $this->setTitle('Find Latest Activities');
     /**
      * Define the search form fields here
      */
     // Allow user to choose which type of contact to limit search on
     $form->add('select', 'contact_type', ts('Find...'), CRM_Core_SelectValues::contactType());
     // Text box for Activity Subject
     $form->add('text', 'activity_subject', ts('Activity Subject'));
     // Select box for Activity Type
     $activityType = array('' => ' - select activity - ') + CRM_Core_PseudoConstant::activityType();
     $form->add('select', 'activity_type_id', ts('Activity Type'), $activityType, FALSE);
     // textbox for Activity Status
     $activityStatus = array('' => ' - select status - ') + CRM_Core_PseudoConstant::activityStatus();
     $form->add('select', 'activity_status_id', ts('Activity Status'), $activityStatus, FALSE);
     // Activity Date range
     $form->addDate('start_date', ts('Activity Date From'), FALSE, array('formatType' => 'custom'));
     $form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
     // Contact Name field
     $form->add('text', 'sort_name', ts('Contact Name'));
     /**
      * If you are using the sample template, this array tells the template fields to render
      * for the search form.
      */
     $form->assign('elements', array('contact_type', 'activity_subject', 'activity_type_id', 'activity_status_id', 'start_date', 'end_date', 'sort_name'));
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:33,代码来源:ActivitySearch.php

示例2: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     // don’t display the ‘Add these Contacts to Group’ button
     $this->_add2groupSupported = FALSE;
     $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
     $this->loggingDB = $dsn['database'];
     // used for redirect back to contact summary
     $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject);
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
     $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
     $this->_logTables = array('log_civicrm_contact' => array('fk' => 'id'), 'log_civicrm_email' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_phone' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_address' => array('fk' => 'contact_id', 'log_type' => 'Contact'), 'log_civicrm_note' => array('fk' => 'entity_id', 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_note_comment' => array('fk' => 'entity_id', 'table_name' => 'log_civicrm_note', 'joins' => array('table' => 'log_civicrm_note', 'join' => "entity_log_civireport.entity_id = fk_table.id AND entity_log_civireport.entity_table = 'civicrm_note'"), 'entity_table' => TRUE, 'bracket_info' => array('table' => 'log_civicrm_note', 'column' => 'subject')), 'log_civicrm_group_contact' => array('fk' => 'contact_id', 'bracket_info' => array('entity_column' => 'group_id', 'table' => 'log_civicrm_group', 'column' => 'title'), 'action_column' => 'status', 'log_type' => 'Group'), 'log_civicrm_entity_tag' => array('fk' => 'entity_id', 'bracket_info' => array('entity_column' => 'tag_id', 'table' => 'log_civicrm_tag', 'column' => 'name'), 'entity_table' => TRUE), 'log_civicrm_relationship' => array('fk' => 'contact_id_a', 'bracket_info' => array('entity_column' => 'relationship_type_id', 'table' => 'log_civicrm_relationship_type', 'column' => 'label_a_b')), 'log_civicrm_activity_for_target' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "(entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$targetID})"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_assignee' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$assigneeID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_activity_for_source' => array('fk' => 'contact_id', 'table_name' => 'log_civicrm_activity', 'joins' => array('table' => 'log_civicrm_activity_contact', 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$sourceID}"), 'bracket_info' => array('entity_column' => 'activity_type_id', 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE)), 'log_type' => 'Activity'), 'log_civicrm_case' => array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_case_contact', 'join' => 'entity_log_civireport.id = fk_table.case_id'), 'bracket_info' => array('entity_column' => 'case_type_id', 'options' => CRM_Case_PseudoConstant::caseType('title', FALSE))));
     $logging = new CRM_Logging_Schema();
     // build _logTables for contact custom tables
     $customTables = $logging->entityCustomDataLogTables('Contact');
     foreach ($customTables as $table) {
         $this->_logTables[$table] = array('fk' => 'entity_id', 'log_type' => 'Contact');
     }
     // build _logTables for address custom tables
     $customTables = $logging->entityCustomDataLogTables('Address');
     foreach ($customTables as $table) {
         $this->_logTables[$table] = array('fk' => 'contact_id', 'joins' => array('table' => 'log_civicrm_address', 'join' => 'entity_log_civireport.entity_id = fk_table.id'), 'log_type' => 'Contact');
     }
     // Allow log tables to be extended via report hooks.
     CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->_logTables);
     parent::__construct();
 }
开发者ID:vincent1892,项目名称:contact_report,代码行数:31,代码来源:ReportSummary.php

示例3: __construct

 function __construct()
 {
     $this->activityTypes = CRM_Core_PseudoConstant::activityType(true, true);
     asort($this->activityTypes);
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name' => array('title' => ts('Modified By'), 'required' => true), 'id' => array('no_display' => true, 'required' => true)), 'filters' => array('sort_name' => array('title' => ts('Modified By'))), 'grouping' => 'contact-fields'), 'civicrm_contact_touched' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name_touched' => array('title' => ts('Touched Contact'), 'name' => 'display_name', 'required' => true), 'id' => array('no_display' => true, 'required' => true)), 'filters' => array('sort_name_touched' => array('title' => ts('Touched Contact'), 'name' => 'sort_name')), 'grouping' => 'contact-fields'), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('title' => ts('Activity'), 'no_display' => true, 'required' => true), 'subject' => array('title' => ts('Touched Activity'), 'required' => true), 'activity_type_id' => array('title' => ts('Activity Type'), 'required' => true), 'source_contact_id' => array('no_display' => true, 'required' => true))), 'civicrm_log' => array('dao' => 'CRM_Core_DAO_Log', 'fields' => array('modified_date' => array('title' => ts('Modified Date'), 'required' => true), 'data' => array('title' => ts('Description'))), 'filters' => array('modified_date' => array('title' => ts('Modified Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE, 'default' => 'this.week'))));
     parent::__construct();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:7,代码来源:RecentChanges.php

示例4: onCaseChange

 /**
  * @param \Civi\CCase\Event\CaseChangeEvent $event
  *
  * @throws \CiviCRM_API3_Exception
  */
 public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event)
 {
     /** @var \Civi\CCase\Analyzer $analyzer */
     $analyzer = $event->analyzer;
     $activitySetXML = $this->getSequenceXml($analyzer->getXml());
     if (!$activitySetXML) {
         return;
     }
     $actTypes = array_flip(\CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name'));
     $actStatuses = array_flip(\CRM_Core_PseudoConstant::activityStatus('name'));
     $actIndex = $analyzer->getActivityIndex(array('activity_type_id', 'status_id'));
     foreach ($activitySetXML->ActivityTypes->ActivityType as $actTypeXML) {
         $actTypeId = $actTypes[(string) $actTypeXML->name];
         if (empty($actIndex[$actTypeId])) {
             // Haven't tried this step yet!
             $this->createActivity($analyzer, $actTypeXML);
             return;
         } elseif (empty($actIndex[$actTypeId][$actStatuses['Completed']])) {
             // Haven't gotten past this step yet!
             return;
         }
     }
     // OK, the activity has completed every step in the sequence!
     civicrm_api3('Case', 'create', array('id' => $analyzer->getCaseId(), 'status_id' => 'Closed'));
     $analyzer->flush();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:31,代码来源:SequenceListener.php

示例5: basicXmlTestCases

 /**
  * Generate a list of basic XML test cases. Each test case creates a
  * custom-group and custom-field then compares the output to a pre-defined
  * XML file. Then, for each test-case, we reverse the process -- we
  * load the XML into a clean DB and see if it creates matching custom-group
  * and custom-field.
  */
 function basicXmlTestCases()
 {
     // a small library which we use to describe test cases
     $fixtures = array();
     $fixtures['textField'] = array('name' => 'test_textfield', 'label' => 'Name1', 'html_type' => 'Text', 'data_type' => 'String', 'default_value' => 'abc', 'weight' => 4, 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1);
     $fixtures['selectField'] = array('label' => 'Our select field', 'html_type' => 'Select', 'data_type' => 'String', 'weight' => 4, 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1, 'option_values' => array(array('weight' => 1, 'label' => 'Label1', 'value' => 1, 'is_active' => 1), array('weight' => 2, 'label' => 'Label2', 'value' => 2, 'is_active' => 1)));
     // the actual test cases
     $cases = array();
     $cases[] = array(array('extends' => 'Contact', 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/Contact-text.xml');
     /*
     $cases[] = array(
       // CustomGroup params
       array(
         'extends' => 'Contact',
         'title' => 'example',
       ),
       // CustomField params
       $fixtures['selectField'],
       // expectedXmlFilePath
       __DIR__ . '/fixtures/Contact-select.xml',
     );
     */
     $cases[] = array(array('extends' => 'Individual', 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/Individual-text.xml');
     $cases[] = array(array('extends' => 'Individual', 'extends_entity_column_value' => array('Student'), 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/IndividualStudent-text.xml');
     $cases[] = array(array('extends' => 'Activity', 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/Activity-text.xml');
     $cases[] = array(array('extends' => 'Activity', 'extends_entity_column_value' => array(array_search('Meeting', CRM_Core_PseudoConstant::activityType())), 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/ActivityMeeting-text.xml');
     return $cases;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:35,代码来源:ImportExportTest.php

示例6: setUp

 public function setUp()
 {
     $this->_apiversion = 3;
     CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
     parent::setUp();
     $this->useTransaction(TRUE);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:7,代码来源:ActivityTypeTest.php

示例7: __construct

 function __construct()
 {
     $this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
     asort($this->activityTypes);
     $this->activityStatuses = CRM_Core_PseudoConstant::activityStatus();
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('id' => array('title' => ts('Contact ID'), 'no_display' => TRUE, 'required' => TRUE), 'sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Contact Name'), 'operator' => 'like', 'type' => CRM_Report_Form::OP_STRING))), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('activity_type_id' => array('title' => ts('Activity Type'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'activity_date_time' => array('title' => ts('Activity Date'), 'default' => TRUE), 'status_id' => array('title' => ts('Activity Status'), 'default' => FALSE, 'type' => CRM_Utils_Type::T_STRING), 'id' => array('title' => ts('Activity ID'), 'default' => TRUE), 'duration' => array('title' => ts('Duration'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_INT), 'subject' => array('title' => ts('Activity Subject'), 'default' => FALSE)), 'filters' => array('activity_date_time' => array('operatorType' => CRM_Report_Form::OP_DATE), 'subject' => array('title' => ts('Activity Subject'), 'operator' => 'like'), 'activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityTypes), 'status_id' => array('title' => ts('Activity Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activityStatuses))), 'civicrm_activity_source' => array('dao' => 'CRM_Activity_DAO_ActivityContact', 'fields' => array('contact_id' => array('title' => ts('Contact ID'), 'default' => TRUE, 'no_display' => TRUE)), 'group_bys' => array('contact_id' => array('title' => ts('Totals Only'), 'default' => TRUE)), 'grouping' => 'activity-fields'), 'civicrm_case_activity' => array('dao' => 'CRM_Case_DAO_CaseActivity', 'fields' => array('case_id' => array('title' => ts('Case ID'), 'default' => FALSE)), 'filters' => array('case_id_filter' => array('name' => 'case_id', 'title' => ts('Cases?'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array(1 => ts('Exclude non-case'), 2 => ts('Exclude cases'), 3 => ts('Include Both')), 'default' => 3))));
     parent::__construct();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:8,代码来源:TimeSpent.php

示例8: buildQuickForm

 public function buildQuickForm()
 {
     // add activity search filter
     $activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
     asort($activityOptions);
     $this->add('select', 'activity_type_filter_id', ts('Activity Type'), array('' => ts('- all activity type(s) -')) + $activityOptions);
     $this->assign('suppressForm', TRUE);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:8,代码来源:ActivityFilter.php

示例9: setUp

 function setUp()
 {
     parent::setUp();
     $this->_contactID = $this->organizationCreate(NULL);
     $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
     $this->_membershipStatusID = $this->membershipStatusCreate('test status');
     $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
     $params = array('contact_id' => $this->_contactID, 'currency' => 'USD', 'financial_type_id' => 1, 'contribution_status_id' => 1, 'contribution_page_id' => NULL, 'payment_instrument_id' => 1, 'source' => 'STUDENT', 'receive_date' => '20080522000000', 'receipt_date' => '20080522000000', 'total_amount' => 200.0, 'trxn_id' => '22ereerwww322323', 'invoice_id' => '22ed39c9e9ee6ef6031621ce0eafe6da70', 'thankyou_date' => '20080522');
     $this->_contribution = $this->callAPISuccess('contribution', 'create', $params);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:10,代码来源:MembershipPaymentTest.php

示例10: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     // Get all activity types
     $activityTypes = CRM_Core_PseudoConstant::activityType(FALSE);
     $this->addElement('select', 'activity_type', ts('Activity Type'), array('3' => ts('Email')) + $activityTypes);
     // Create the Submit Button.
     $buttons = array(array('type' => 'submit', 'name' => ts('Save')));
     // Add the Buttons.
     $this->addButtons($buttons);
     parent::buildQuickForm();
 }
开发者ID:krishgopi,项目名称:uk.co.vedaconsulting.outlookapi,代码行数:17,代码来源:Setting.php

示例11: __construct

 public function __construct()
 {
     $this->case_types = CRM_Case_PseudoConstant::caseType();
     $this->case_statuses = CRM_Core_OptionGroup::values('case_status');
     $rels = CRM_Core_PseudoConstant::relationshipType();
     foreach ($rels as $relid => $v) {
         $this->rel_types[$relid] = $v['label_b_a'];
     }
     $this->deleted_labels = array('' => ts('- select -'), 0 => ts('No'), 1 => ts('Yes'));
     $this->_columns = array('civicrm_c2' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('client_name' => array('name' => 'sort_name', 'title' => ts('Client'), 'required' => TRUE), 'id' => array('no_display' => TRUE, 'required' => TRUE))), 'civicrm_case' => array('dao' => 'CRM_Case_DAO_Case', 'fields' => array('id' => array('title' => ts('Case ID'), 'required' => TRUE), 'subject' => array('title' => ts('Case Subject'), 'default' => FALSE), 'status_id' => array('title' => ts('Status'), 'default' => FALSE), 'case_type_id' => array('title' => ts('Case Type'), 'default' => FALSE), 'start_date' => array('title' => ts('Start Date'), 'default' => TRUE, 'type' => CRM_Utils_Type::T_DATE), 'end_date' => array('title' => ts('End Date'), 'default' => FALSE, 'type' => CRM_Utils_Type::T_DATE), 'duration' => array('title' => ts('Duration (Days)'), 'default' => FALSE), 'is_deleted' => array('title' => ts('Deleted?'), 'default' => FALSE, 'type' => CRM_Utils_Type::T_INT)), 'filters' => array('start_date' => array('title' => ts('Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE), 'end_date' => array('title' => ts('End Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE), 'case_type_id' => array('title' => ts('Case Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->case_types), 'status_id' => array('title' => ts('Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->case_statuses), 'is_deleted' => array('title' => ts('Deleted?'), 'type' => CRM_Report_Form::OP_INT, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $this->deleted_labels, 'default' => 0))), 'civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Staff Member'), 'default' => FALSE)), 'filters' => array('my_cases' => array('title' => ts('My cases'), 'type' => CRM_Utils_Type::T_BOOLEAN, 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('0' => ts('No'), '1' => ts('Yes')), 'pseudofield' => TRUE))), 'civicrm_relationship' => array('dao' => 'CRM_Contact_DAO_Relationship', 'filters' => array('relationship_type_id' => array('title' => ts('Staff Relationship'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->rel_types))), 'civicrm_relationship_type' => array('dao' => 'CRM_Contact_DAO_RelationshipType', 'fields' => array('label_b_a' => array('title' => ts('Relationship'), 'default' => FALSE))), 'civicrm_case_contact' => array('dao' => 'CRM_Case_DAO_CaseContact'), 'civicrm_activity' => array('filters' => array('activity_type_id' => array('title' => ts('Activity Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE), 'pseudofield' => TRUE))));
     parent::__construct();
 }
开发者ID:CiviCooP,项目名称:be.werkenmetzin.casereports,代码行数:12,代码来源:Facturatie.php

示例12: setUp

 /**
  * Set up for tests.
  */
 public function setUp()
 {
     parent::setUp();
     $this->_apiversion = 3;
     $this->_contactID = $this->individualCreate();
     $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
     $this->_membershipTypeID2 = $this->membershipTypeCreate(array('period_type' => 'fixed', 'fixed_period_start_day' => '301', 'fixed_period_rollover_day' => '1111'));
     $this->_membershipStatusID = $this->membershipStatusCreate('test status');
     CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
     CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'name', TRUE);
     CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
     $this->_entity = 'Membership';
     $this->_params = array('contact_id' => $this->_contactID, 'membership_type_id' => $this->_membershipTypeID, 'join_date' => '2009-01-21', 'start_date' => '2009-01-21', 'end_date' => '2009-12-21', 'source' => 'Payment', 'is_override' => 1, 'status_id' => $this->_membershipStatusID);
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:17,代码来源:MembershipTest.php

示例13: civicrm_api3_activity_getabsences

/**
 * Activity.GetAbsences API
 *
 * This is a variation on Activity.get with additional filtering behavior suitable for activities.
 *
 * @param array $params
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_activity_getabsences($params)
{
    // activity_type_id: int|string|array(int|string)
    // period_id: int|array(int)
    // target_contact_id: int
    $activityTypes = CRM_Core_PseudoConstant::activityType();
    // ****** Defaults ******
    if (!isset($params['activity_type_id'])) {
        $params['activity_type_id'] = CRM_HRAbsence_BAO_HRAbsenceType::getActivityTypes();
    }
    // ****** Build query ******
    $select = new CRM_HRAbsence_DGWDIHTWT('civicrm_activity request');
    $select->select('request.*')->groupBy('request.id')->join('absence', 'INNER JOIN civicrm_activity absence ON (absence.source_record_id = request.id AND absence.activity_type_id = #typeId)', array('#typeId' => array_search('Absence', $activityTypes)));
    if (!empty($params['period_id'])) {
        $periodIds = (array) $params['period_id'];
        $dateExprs = array();
        // array(string $sqlExpression)
        foreach ($periodIds as $periodId) {
            $period = civicrm_api3('HRAbsencePeriod', 'getsingle', array('id' => $periodId));
            $dateExprs[] = $select->interpolate('min(absence.activity_date_time) between @start and @end', array('@start' => $period['start_date'], '@end' => $period['end_date']));
        }
        $select->having(implode(' or ', $dateExprs));
    }
    if (!empty($params['activity_type_id'])) {
        $typeIds = (array) $params['activity_type_id'];
        foreach (array_keys($typeIds) as $key) {
            if (!is_numeric($typeIds[$key])) {
                $typeIds[$key] = array_search($typeIds[$key], $activityTypes);
                if ($typeIds[$key] === FALSE) {
                    throw new API_Exception("Invalid activity type");
                }
            }
        }
        $select->where('request.activity_type_id IN (#typeIds)', array('#typeIds' => $typeIds));
    }
    if (!empty($params['target_contact_id'])) {
        $activityContactTypes = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
        $select->join('tgt', 'INNER JOIN civicrm_activity_contact tgt
        ON tgt.activity_id = request.id
        AND tgt.record_type_id = #tgt
        AND tgt.contact_id IN (#targetIds)', array('#tgt' => CRM_Utils_Array::key('Activity Targets', $activityContactTypes), '#targetIds' => (array) $params['target_contact_id']));
    }
    // ****** Execute query ******
    $entity = _civicrm_api3_get_BAO(__FUNCTION__);
    $bao = CRM_Core_DAO::executeQuery($select->toSQL(), array(), TRUE, 'CRM_Activity_BAO_Activity');
    $activities = _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity, FALSE);
    $activities = _civicrm_api3_activity_get_formatResult($params, $activities);
    return civicrm_api3_create_success($activities, $params, $entity, 'getAbsences');
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:60,代码来源:Getabsences.php

示例14: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @param null
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     $subTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $this->_surveyId, 'activity_type_id');
     if (!CRM_Core_BAO_CustomGroup::autoCreateByActivityType($subTypeId)) {
         $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE, FALSE);
         // everything
         // FIXME: Displays weird "/\ Array" message; doesn't work with tabs
         CRM_Core_Session::setStatus(ts('There are no custom data sets for activity type "%1". To create one, <a href="%2" target="%3">click here</a>.', array(1 => $activityTypes[$subTypeId], 2 => CRM_Utils_System::url('civicrm/admin/custom/group', 'action=add&reset=1'), 3 => '_blank')));
     }
     $allowCoreTypes = CRM_Campaign_BAO_Survey::surveyProfileTypes();
     $allowSubTypes = array('ActivityType' => array($subTypeId));
     $entities = array(array('entity_name' => 'contact_1', 'entity_type' => 'IndividualModel'), array('entity_name' => 'activity_1', 'entity_type' => 'ActivityModel', 'entity_sub_type' => $subTypeId));
     $this->addProfileSelector('contact_profile_id', ts('Contact Info'), $allowCoreTypes, $allowSubTypes, $entities);
     $this->addProfileSelector('activity_profile_id', ts('Questions'), $allowCoreTypes, $allowSubTypes, $entities);
     // Note: Because this is in a tab, we also preload the schema via CRM_Campaign_Form_Survey::preProcess
     parent::buildQuickForm();
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:25,代码来源:Questions.php

示例15: createManagedActivityTypes

 /**
  * Get a list of managed activity-types by searching CiviCase XML files
  *
  * @return array
  * @see CRM_Utils_Hook::managed
  * @throws CRM_Core_Exception
  */
 public static function createManagedActivityTypes(CRM_Case_XMLRepository $xmlRepo, CRM_Core_ManagedEntities $me)
 {
     $result = array();
     $validActTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
     $actTypes = $xmlRepo->getAllDeclaredActivityTypes();
     foreach ($actTypes as $actType) {
         $managed = array('module' => 'civicrm', 'name' => "civicase:act:{$actType}", 'entity' => 'OptionValue', 'update' => 'never', 'cleanup' => 'unused', 'params' => array('version' => 3, 'option_group_id' => 'activity_type', 'label' => $actType, 'name' => $actType, 'description' => $actType, 'component_id' => 'CiviCase'));
         // We'll create managed-entity if this record doesn't exist yet
         // or if we previously decided to manage this record.
         if (!in_array($actType, $validActTypes)) {
             $result[] = $managed;
         } elseif ($me->get($managed['module'], $managed['name'])) {
             $result[] = $managed;
         }
     }
     return $result;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:24,代码来源:ManagedEntities.php


注:本文中的CRM_Core_PseudoConstant::activityType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。