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


PHP CRM_Core_OptionGroup::getValue方法代码示例

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


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

示例1: search

 /**
  * Performs the search.
  *
  * Stashes the results in $this->searchResults.
  *
  * @return array $this->searchResults
  */
 public function search()
 {
     $projects = CRM_Volunteer_BAO_Project::retrieve($this->searchParams['project']);
     foreach ($projects as $project) {
         $results = array();
         $flexibleNeed = civicrm_api3('VolunteerNeed', 'getsingle', array('id' => $project->flexible_need_id));
         if ($flexibleNeed['visibility_id'] === CRM_Core_OptionGroup::getValue('visibility', 'public', 'name')) {
             $needId = $flexibleNeed['id'];
             $results[$needId] = $flexibleNeed;
         }
         $openNeeds = $project->open_needs;
         foreach ($openNeeds as $key => $need) {
             if ($this->needFitsSearchCriteria($need)) {
                 $results[$key] = $need;
             }
         }
         if (!empty($results)) {
             $this->projects[$project->id] = array();
         }
         $this->searchResults += $results;
     }
     $this->getSearchResultsProjectData();
     usort($this->searchResults, array($this, "usortDateAscending"));
     return $this->searchResults;
 }
开发者ID:TobiasLounsbury,项目名称:org.civicrm.volunteer,代码行数:32,代码来源:NeedSearch.php

示例2: getBatchList

 /**
  * Retrieve records.
  */
 public static function getBatchList()
 {
     $sortMapper = array(0 => 'batch.title', 1 => 'batch.type_id', 2 => '', 3 => 'batch.total', 4 => 'batch.status_id', 5 => '');
     $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
     $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
     $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
     $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL;
     $params = $_REQUEST;
     if ($sort && $sortOrder) {
         $params['sortBy'] = $sort . ' ' . $sortOrder;
     }
     $params['page'] = $offset / $rowCount + 1;
     $params['rp'] = $rowCount;
     if ($context != 'financialBatch') {
         // data entry status batches
         $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     }
     $params['context'] = $context;
     // get batch list
     $batches = CRM_Batch_BAO_Batch::getBatchListSelector($params);
     $iFilteredTotal = $iTotal = $params['total'];
     if ($context == 'financialBatch') {
         $selectorElements = array('check', 'batch_name', 'payment_instrument', 'item_count', 'total', 'status', 'created_by', 'links');
     } else {
         $selectorElements = array('batch_name', 'type', 'item_count', 'total', 'status', 'created_by', 'links');
     }
     CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:35,代码来源:AJAX.php

示例3: _civicrm_api3_volunteer_need_create_spec

/**
 * Adjust Metadata for Create action
 *
 * The metadata is used for setting defaults, documentation & validation
 * @param array $params array or parameters determined by getfields
 */
function _civicrm_api3_volunteer_need_create_spec(&$params)
{
    $params['project_id']['api.required'] = 1;
    $params['is_flexible']['api.default'] = 0;
    $params['is_active']['api.default'] = 1;
    $params['visibility_id']['api.default'] = CRM_Core_OptionGroup::getValue('visibility', 'public', 'name');
}
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:13,代码来源:VolunteerNeed.php

示例4: buildQuickForm

 /**
  * Common form elements.
  */
 public function buildQuickForm()
 {
     $config = CRM_Core_Config::singleton();
     $uploadFileSize = CRM_Utils_Number::formatUnitSize($config->maxFileSize . 'm', TRUE);
     $uploadSize = round($uploadFileSize / (1024 * 1024), 2);
     $this->assign('uploadSize', $uploadSize);
     $this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
     $this->setMaxFileSize($uploadFileSize);
     $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
     $this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
     $this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
     $this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
     $this->add('text', 'fieldSeparator', ts('Import Field Separator'), array('size' => 2), TRUE);
     $this->setDefaults(array('fieldSeparator' => $config->fieldSeparator));
     //get the saved mapping details
     $mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import ' . static::IMPORT_ENTITY, 'name'));
     $this->assign('savedMapping', $mappingArray);
     $this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
     if ($loadedMapping = $this->get('loadedMapping')) {
         $this->assign('loadedMapping', $loadedMapping);
         $this->setDefaults(array('savedMapping' => $loadedMapping));
     }
     //build date formats
     CRM_Core_Form_Date::buildAllowedDateFormats($this);
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue'), 'spacing' => '          ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:29,代码来源:DataSource.php

示例5: testCreateNeed

 /**
  * Test simple create via API
  */
 function testCreateNeed()
 {
     $project = CRM_Core_DAO::createTestObject('CRM_Volunteer_BAO_Project');
     $this->assertObjectHasAttribute('id', $project, 'Failed to prepopulate Volunteer Project');
     $params = array("project_id" => $project->id, "start_time" => "2013-12-17 16:00:00", "duration" => 240, "is_flexible" => 0, "quantity" => 1, "visibility_id" => CRM_Core_OptionGroup::getValue('visibility', 'public', 'name'), "role_id" => 1, "is_active" => 1);
     $this->callAPIAndDocument('VolunteerNeed', 'create', $params, __FUNCTION__, __FILE__);
 }
开发者ID:RussellAult,项目名称:org.civicrm.volunteer,代码行数:10,代码来源:VolunteerNeedTest.php

示例6: preProcess

 /**
  * @param CRM_Core_Form $form
  */
 public static function preProcess(&$form)
 {
     //get multi client case configuration
     $xmlProcessorProcess = new CRM_Case_XMLProcessor_Process();
     $form->_allowMultiClient = (bool) $xmlProcessorProcess->getAllowMultipleCaseClients();
     if ($form->_context == 'caseActivity') {
         $contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $form);
         $atype = CRM_Core_OptionGroup::getValue('activity_type', 'Change Case Start Date', 'name');
         $caseId = CRM_Utils_Array::first($form->_caseId);
         $form->assign('changeStartURL', CRM_Utils_System::url('civicrm/case/activity', "action=add&reset=1&cid={$contactID}&caseid={$caseId}&atype={$atype}"));
         return;
     }
     $form->_context = CRM_Utils_Request::retrieve('context', 'String', $form);
     $form->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $form);
     $form->assign('context', $form->_context);
     // check if the case type id passed in url is a valid one
     $caseTypeId = CRM_Utils_Request::retrieve('ctype', 'Positive', $form);
     $caseTypes = CRM_Case_PseudoConstant::caseType();
     $form->_caseTypeId = array_key_exists($caseTypeId, $caseTypes) ? $caseTypeId : NULL;
     // check if the case status id passed in url is a valid one
     $caseStatusId = CRM_Utils_Request::retrieve('case_status_id', 'Positive', $form);
     $caseStatus = CRM_Case_PseudoConstant::caseStatus();
     $form->_caseStatusId = array_key_exists($caseStatusId, $caseStatus) ? $caseStatusId : NULL;
     // Add attachments
     CRM_Core_BAO_File::buildAttachment($form, 'civicrm_activity', $form->_activityId);
     $session = CRM_Core_Session::singleton();
     $session->pushUserContext(CRM_Utils_System::url('civicrm/case', 'reset=1'));
 }
开发者ID:kidaa30,项目名称:yes,代码行数:31,代码来源:OpenCase.php

示例7: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     //Setting Upload File Size
     $config = CRM_Core_Config::singleton();
     $uploadFileSize = CRM_Core_Config_Defaults::formatUnitSize($config->maxFileSize . 'm', TRUE);
     $uploadSize = round($uploadFileSize / (1024 * 1024), 2);
     $this->assign('uploadSize', $uploadSize);
     $this->setMaxFileSize($uploadFileSize);
     $this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
     $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(1 => $uploadSize, 2 => $uploadFileSize)), 'maxfilesize', $uploadFileSize);
     $this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
     $this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
     $this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
     $duplicateOptions = array();
     $duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Skip'), CRM_Import_Parser::DUPLICATE_SKIP);
     $duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Update'), CRM_Import_Parser::DUPLICATE_UPDATE);
     $duplicateOptions[] = $this->createElement('radio', NULL, NULL, ts('Fill'), CRM_Import_Parser::DUPLICATE_FILL);
     $this->addGroup($duplicateOptions, 'onDuplicate', ts('On duplicate entries'));
     //get the saved mapping details
     $mappingArray = CRM_Core_BAO_Mapping::getMappings(CRM_Core_OptionGroup::getValue('mapping_type', 'Import Activity', 'name'));
     $this->assign('savedMapping', $mappingArray);
     $this->add('select', 'savedMapping', ts('Mapping Option'), array('' => ts('- select -')) + $mappingArray);
     if ($loadeMapping = $this->get('loadedMapping')) {
         $this->assign('loadedMapping', $loadeMapping);
         $this->setDefaults(array('savedMapping' => $loadeMapping));
     }
     $this->setDefaults(array('onDuplicate' => CRM_Import_Parser::DUPLICATE_SKIP));
     //build date formats
     CRM_Core_Form_Date::buildAllowedDateFormats($this);
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue'), 'spacing' => '          ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:kidaa30,项目名称:yes,代码行数:36,代码来源:DataSource.php

示例8: _civicrm_initialize

/**
 * Create a new Activity.
 *
 * Creates a new Activity record and returns the newly created
 * activity object (including the contact_id property). Minimum
 * required data values for the various contact_type are:
 *
 * Properties which have administratively assigned sets of values
 * If an unrecognized value is passed, an error
 * will be returned. 
 *
 * Modules may invoke crm_get_contact_values($contactID) to
 * retrieve a list of currently available values for a given
 * property.
 * @param array  $params       Associative array of property name/value
 *                             pairs to insert in new contact.
 * @param string $activity_type Which class of contact is being created.
 *            Valid values = 'SMS', 'Meeting', 'Event', 'PhoneCall'.
 * {@schema Activity/Activity.xml}
 *                            
 * @return CRM_Activity|CRM_Error Newly created Activity object
 * 
 */
function &civicrm_activity_create(&$params)
{
    _civicrm_initialize();
    $errors = array();
    // check for various error and required conditions
    $errors = _civicrm_activity_check_params($params, true);
    if (!empty($errors)) {
        return $errors;
    }
    // processing for custom data
    $values = array();
    _civicrm_custom_format_params($params, $values, 'Activity');
    if (!empty($values['custom'])) {
        $params['custom'] = $values['custom'];
    }
    if (!CRM_Utils_Array::value('activity_type_id', $params)) {
        $params['activity_type_id'] = CRM_Core_OptionGroup::getValue('activity_type', $params['activity_name'], 'name');
    }
    // create activity
    $activity = CRM_Activity_BAO_Activity::create($params);
    if (!is_a($activity, 'CRM_Core_Error') && isset($activity->id)) {
        $activityArray = array('is_error' => 0);
    } else {
        $activityArray = array('is_error' => 1);
    }
    _civicrm_object_to_array($activity, $activityArray);
    return $activityArray;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:51,代码来源:Activity.php

示例9: hrvisa_civicrm_install

/**
 * Implementation of hook_civicrm_install
 */
function hrvisa_civicrm_install()
{
    if (!CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name')) {
        // create activity_type 'Visa Expiration'
        $params = array('weight' => 1, 'label' => 'Visa Expiration', 'filter' => 0, 'is_active' => 1, 'is_default' => 0);
        $result = civicrm_api3('activity_type', 'create', $params);
        if (CRM_Utils_Array::value('is_error', $result, FALSE)) {
            CRM_Core_Error::debug_var("Failed to create activity type 'Visa  Expiration'", $result);
            throw new CRM_Core_Exception('Failed to create activity type \'Visa  Expiration\'');
        }
        $activityTypeId = $result['values'][$result['id']]['value'];
    } else {
        $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Visa Expiration', 'name');
    }
    // set weekly reminder for Visa Expiration activities (not active)
    // will be active when extension is enabled
    if (!empty($activityTypeId)) {
        $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
        $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
        // schedule reminder for Visa Expiration Creation
        $result = civicrm_api3('action_schedule', 'get', array('name' => 'Visa Expiration Reminder'));
        if (empty($result['id'])) {
            $params = array('name' => 'Visa Expiration Reminder', 'title' => 'Visa Expiration Reminder', 'recipient' => $targetID, 'limit_to' => 1, 'entity_value' => $activityTypeId, 'entity_status' => CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name'), 'start_action_offset' => 1, 'start_action_unit' => 'week', 'start_action_condition' => 'before', 'start_action_date' => 'activity_date_time', 'is_repeat' => 0, 'is_active' => 0, 'body_html' => '<p>Your latest visa expiries on {activity.activity_date_time}</p>', 'subject' => 'Reminder for Visa Expiration', 'record_activity' => 1, 'mapping_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value'));
            $result = civicrm_api3('action_schedule', 'create', $params);
        }
    }
    return _hrvisa_civix_civicrm_install();
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:31,代码来源:hrvisa.php

示例10: createMandate

 /**
  * create a mandate
  *
  * @author endres -at- systopia.de
  * @return array with mandate data
  */
 function createMandate($mandate_parms = array(), $contrib_parms = array())
 {
     // read the payment instrument ids
     $payment_instrument_OOFF = (int) CRM_Core_OptionGroup::getValue('payment_instrument', 'OOFF', 'name');
     $this->assertNotEmpty($payment_instrument_OOFF, "Could not find the 'OOFF' payment instrument.");
     $payment_instrument_RCUR = (int) CRM_Core_OptionGroup::getValue('payment_instrument', 'RCUR', 'name');
     $this->assertNotEmpty($payment_instrument_RCUR, "Could not find the 'RCUR' payment instrument.");
     $contribution_status_pending = (int) CRM_Core_OptionGroup::getValue('contribution_status', 'Pending', 'name');
     $this->assertNotEmpty($contribution_status_pending, "Could not find the 'Pending' contribution status.");
     $mode = empty($mandate_parms['type']) ? 'OOFF' : $mandate_parms['type'];
     $this->assertTrue($mode == 'OOFF' || $mode == 'RCUR', "Mandat can only be of type 'OOFF' or 'RCUR'!");
     $contribution_entity = $mode == 'OOFF' ? 'Contribution' : 'ContributionRecur';
     $contribution_table = $mode == 'OOFF' ? 'civicrm_contribution' : 'civicrm_contribution_recur';
     // create a contribution
     $create_contribution = array('contact_id' => empty($contrib_parms['contact_id']) ? $this->individualCreate() : $contrib_parms['contact_id'], 'financial_type_id' => empty($contrib_parms['financial_type_id']) ? 1 : $contrib_parms['financial_type_id'], 'currency' => empty($contrib_parms['currency']) ? 'EUR' : $contrib_parms['currency'], 'contribution_status_id' => empty($contrib_parms['contribution_status_id']) ? $contribution_status_pending : $contrib_parms['contribution_status_id'], 'is_test' => empty($contrib_parms['is_test']) ? 0 : $contrib_parms['is_test']);
     if ($mode == 'RCUR') {
         $create_contribution['payment_instrument_id'] = $payment_instrument_RCUR;
         $create_contribution['amount'] = empty($contrib_parms['amount']) ? '6.66' : $contrib_parms['amount'];
         $create_contribution['start_date'] = empty($contrib_parms['start_date']) ? date("Ymd") : $contrib_parms['start_date'];
         $create_contribution['end_date'] = empty($contrib_parms['end_date']) ? NULL : $contrib_parms['end_date'];
         $create_contribution['frequency_interval'] = empty($contrib_parms['frequency_interval']) ? 1 : $contrib_parms['frequency_interval'];
         $create_contribution['frequency_unit'] = empty($contrib_parms['frequency_unit']) ? 'month' : $contrib_parms['frequency_unit'];
         $create_contribution['cycle_day'] = empty($contrib_parms['cycle_day']) ? date("d", strtotime("+14 days")) : $contrib_parms['cycle_day'];
     } else {
         $create_contribution['payment_instrument_id'] = $payment_instrument_OOFF;
         $create_contribution['total_amount'] = empty($contrib_parms['total_amount']) ? '6.66' : $contrib_parms['total_amount'];
         $create_contribution['receive_date'] = empty($contrib_parms['receive_date']) ? date('YmdHis') : $contrib_parms['receive_date'];
     }
     $contribution = $this->callAPISuccess($contribution_entity, "create", $create_contribution);
     // create a mandate
     $create_mandate = array("type" => empty($mandate_parms['type']) ? 'OOFF' : $mandate_parms['type'], "status" => empty($mandate_parms['status']) ? 'INIT' : $mandate_parms['status'], "reference" => empty($mandate_parms['reference']) ? md5(microtime()) : $mandate_parms['reference'], "source" => empty($mandate_parms['source']) ? "TestSource" : $mandate_parms['source'], "date" => empty($mandate_parms['date']) ? date("YmdHis") : $mandate_parms['date'], "creditor_id" => empty($mandate_parms['creditor_id']) ? $this->getCreditor() : $mandate_parms['creditor_id'], "contact_id" => empty($mandate_parms['contact_id']) ? $create_contribution['contact_id'] : $mandate_parms['contact_id'], "iban" => empty($mandate_parms['iban']) ? "DE89370400440532013000" : $mandate_parms['iban'], "bic" => empty($mandate_parms['bic']) ? "INGDDEFFXXX" : $mandate_parms['bic'], "creation_date" => empty($mandate_parms['creation_date']) ? date("YmdHis") : $mandate_parms['creation_date'], "entity_table" => $contribution_table, "entity_id" => $contribution['id']);
     $mandate = $this->callAPISuccess("SepaMandate", "create", $create_mandate);
     return $mandate['values'][$mandate['id']];
 }
开发者ID:FundingWorks,项目名称:org.project60.sepa,代码行数:40,代码来源:BaseTestCase.php

示例11: __construct

 function __construct()
 {
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name' => array('title' => ts('Contact Name'), 'required' => TRUE, 'no_repeat' => TRUE), 'gender_id' => array('title' => ts('Gender'), 'default' => TRUE), 'birth_date' => array('title' => ts('Birthdate'), 'default' => FALSE), 'id' => array('no_display' => TRUE, 'required' => TRUE)), 'filters' => array('sort_name' => array('title' => ts('Contact Name'), 'operatorType' => CRM_Report_Form::OP_STRING), 'contact_type' => array('title' => ts('Contact Type'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => array('' => ts('-select-'), 'Individual' => ts('Individual'), 'Organization' => ts('Organization'), 'Household' => ts('Household')), 'default' => 'Individual'), 'id' => array('title' => ts('Contact ID'), 'no_display' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'grouping' => 'contact-fields', 'fields' => array('street_address' => array('default' => FALSE), 'city' => array('default' => TRUE), 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'), 'default' => FALSE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => NULL), 'grouping' => 'contact-fields'), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('title' => ts('Activity ID'), 'no_display' => TRUE, 'required' => TRUE))), 'civicrm_case' => array('dao' => 'CRM_Case_DAO_Case', 'fields' => array('id' => array('title' => ts('Case ID'), 'required' => TRUE), 'start_date' => array('title' => ts('Case Start'), 'required' => TRUE), 'end_date' => array('title' => ts('Case End'), 'required' => TRUE)), 'filters' => array('case_id_filter' => array('name' => '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), 'start_date' => array('title' => ts('Case Start'), 'operatorType' => CRM_Report_Form::OP_DATE), 'end_date' => array('title' => ts('Case End'), 'operatorType' => CRM_Report_Form::OP_DATE))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_Group', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
     $this->_tagFilter = TRUE;
     $open_case_val = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
     $crmDAO =& CRM_Core_DAO::executeQuery("SELECT cg.table_name, cg.extends AS ext, cf.label, cf.column_name FROM civicrm_custom_group cg INNER JOIN civicrm_custom_field cf ON cg.id = cf.custom_group_id\nwhere (cg.extends='Contact' OR cg.extends='Individual' OR cg.extends_entity_column_value='{$open_case_val}') AND cg.is_active=1 AND cf.is_active=1 ORDER BY cg.table_name");
     $curTable = '';
     $curExt = '';
     $curFields = array();
     while ($crmDAO->fetch()) {
         if ($curTable == '') {
             $curTable = $crmDAO->table_name;
             $curExt = $crmDAO->ext;
         } elseif ($curTable != $crmDAO->table_name) {
             // dummy DAO
             $this->_columns[$curTable] = array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $curFields, 'ext' => $curExt);
             $curTable = $crmDAO->table_name;
             $curExt = $crmDAO->ext;
             $curFields = array();
         }
         $curFields[$crmDAO->column_name] = array('title' => $crmDAO->label);
     }
     if (!empty($curFields)) {
         // dummy DAO
         $this->_columns[$curTable] = array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => $curFields, 'ext' => $curExt);
     }
     $this->_genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
     parent::__construct();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:29,代码来源:Demographics.php

示例12: buildQuickForm

 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     $this->add('text', 'title', ts('Petition Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'title'), TRUE);
     $attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey');
     $petitionTypeID = CRM_Core_OptionGroup::getValue('activity_type', 'petition', 'name');
     $this->addElement('hidden', 'activity_type_id', $petitionTypeID);
     // script / instructions / description of petition purpose
     $this->addWysiwyg('instructions', ts('Introduction'), $attributes['instructions']);
     // Campaign id
     $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('campaign_id', $this->_values));
     $this->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns);
     $customContactProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Individual'));
     // custom group id
     $this->add('select', 'contact_profile_id', ts('Contact Profile'), array('' => ts('- select -')) + $customContactProfiles, TRUE);
     $customProfiles = CRM_Core_BAO_UFGroup::getProfiles(array('Activity'));
     // custom group id
     $this->add('select', 'profile_id', ts('Activity Profile'), array('' => ts('- select -')) + $customProfiles);
     // thank you title and text (html allowed in text)
     $this->add('text', 'thankyou_title', ts('Thank-you Page Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'thankyou_title'));
     $this->addWysiwyg('thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'thankyou_text'));
     // bypass email confirmation?
     $this->add('checkbox', 'bypass_confirm', ts('Bypass email confirmation'));
     // is active ?
     $this->add('checkbox', 'is_active', ts('Is Active?'));
     // is default ?
     $this->add('checkbox', 'is_default', ts('Is Default?'));
     // add buttons
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
     // add a form rule to check default value
     $this->addFormRule(array('CRM_Campaign_Form_Survey', 'formRule'), $this);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:35,代码来源:Petition.php

示例13: creatNewShortcut

 public function creatNewShortcut(&$shortCuts)
 {
     if (CRM_Core_Permission::check('access all cases and activities') || CRM_Core_Permission::check('add cases')) {
         $atype = CRM_Core_OptionGroup::getValue('activity_type', 'Open Case', 'name');
         if ($atype) {
             $shortCuts = array_merge($shortCuts, array(array('path' => 'civicrm/case/add', 'query' => "reset=1&action=add&atype={$atype}&context=standalone", 'ref' => 'new-case', 'title' => ts('Case'))));
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:9,代码来源:Info.php

示例14: testActivityTarget

 /**
  * Tests CRM_Volunteer_BAO_Assignment::createVolunteerActivity() to ensure
  * that the project beneficiary is made the activity target.
  */
 function testActivityTarget()
 {
     $beneficiaryContactId = $need = $project = $volunteerContactId = NULL;
     extract($this->setUpProject(), EXTR_IF_EXISTS);
     $projectContact = CRM_Core_DAO::createTestObject('CRM_Volunteer_BAO_ProjectContact', array('contact_id' => $beneficiaryContactId, 'project_id' => $project->id, 'relationship_type_id' => CRM_Core_OptionGroup::getValue('volunteer_project_relationship', 'volunteer_beneficiary', 'name')));
     $this->assertObjectHasAttribute('id', $projectContact, 'Failed to prepopulate VolunteerContact');
     $assignmentId = CRM_Volunteer_BAO_Assignment::createVolunteerActivity(array('assignee_contact_id' => $volunteerContactId, 'source_contact_id' => $volunteerContactId, 'volunteer_need_id' => $need->id));
     $targetContactId = civicrm_api3('ActivityContact', 'getvalue', array('activity_id' => $assignmentId, 'record_type_id' => 'Activity Targets', 'return' => 'contact_id'));
     $this->assertEquals($beneficiaryContactId, $targetContactId);
 }
开发者ID:RussellAult,项目名称:org.civicrm.volunteer,代码行数:14,代码来源:AssignmentTest.php

示例15: preProcess

 /**  
  * Function to set variables up before form is built  
  *                                                            
  * @return void  
  * @access public  
  */
 public function preProcess()
 {
     require_once 'CRM/Event/BAO/Participant.php';
     $values = $ids = array();
     $participantID = CRM_Utils_Request::retrieve('id', 'Positive', $this, true);
     $contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this, true);
     $params = array('id' => $participantID);
     CRM_Event_BAO_Participant::getValues($params, $values, $ids);
     if (empty($values)) {
         require_once 'CRM/Core/Error.php';
         CRM_Core_Error::statusBounce(ts('The requested participant record does not exist (possibly the record was deleted).'));
     }
     CRM_Event_BAO_Participant::resolveDefaults($values[$participantID]);
     if (CRM_Utils_Array::value('fee_level', $values[$participantID])) {
         CRM_Event_BAO_Participant::fixEventLevel($values[$participantID]['fee_level']);
     }
     if ($values[$participantID]['is_test']) {
         $values[$participantID]['status'] .= ' (test) ';
     }
     // Get Note
     $noteValue = CRM_Core_BAO_Note::getNote($participantID, 'civicrm_participant');
     $values[$participantID]['note'] = array_values($noteValue);
     require_once 'CRM/Price/BAO/LineItem.php';
     // Get Line Items
     $lineItem = CRM_Price_BAO_LineItem::getLineItems($participantID);
     if (!CRM_Utils_System::isNull($lineItem)) {
         $values[$participantID]['lineItem'][] = $lineItem;
     }
     $values[$participantID]['totalAmount'] = $values[$participantID]['fee_amount'];
     // get the option value for custom data type
     $roleCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantRole', 'name');
     $eventNameCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventName', 'name');
     $eventTypeCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventType', 'name');
     $roleGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, null, $values[$participantID]['role_id'], $roleCustomDataTypeID);
     $eventGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, null, $values[$participantID]['event_id'], $eventNameCustomDataTypeID);
     $eventTypeID = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $values[$participantID]['event_id'], 'event_type_id', 'id');
     $eventTypeGroupTree =& CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID, null, $eventTypeID, $eventTypeCustomDataTypeID);
     $groupTree = CRM_Utils_Array::crmArrayMerge($roleGroupTree, $eventGroupTree);
     $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, $eventTypeGroupTree);
     $groupTree = CRM_Utils_Array::crmArrayMerge($groupTree, CRM_Core_BAO_CustomGroup::getTree('Participant', $this, $participantID));
     CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
     $this->assign($values[$participantID]);
     // add viewed participant to recent items list
     require_once 'CRM/Utils/Recent.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     $url = CRM_Utils_System::url('civicrm/contact/view/participant', "action=view&reset=1&id={$values[$participantID]['id']}&cid={$values[$participantID]['contact_id']}&context=home");
     $participantRoles = CRM_Event_PseudoConstant::participantRole();
     $eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $values[$participantID]['event_id'], 'title');
     $displayName = CRM_Contact_BAO_Contact::displayName($contactID);
     $this->assign('displayName', $displayName);
     $title = $displayName . ' (' . $participantRoles[$values[$participantID]['role_id']] . ' - ' . $eventTitle . ')';
     // add Participant to Recent Items
     CRM_Utils_Recent::add($title, $url, $values[$participantID]['id'], 'Participant', $values[$participantID]['contact_id'], null);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:60,代码来源:ParticipantView.php


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