• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Utils_Array类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: route

 /**
  * @param array $cxn
  * @param string $entity
  * @param string $action
  * @param array $params
  * @return mixed
  */
 public static function route($cxn, $entity, $action, $params)
 {
     $SUPER_PERM = array('administer CiviCRM');
     require_once 'api/v3/utils.php';
     // FIXME: Shouldn't the X-Forwarded-Proto check be part of CRM_Utils_System::isSSL()?
     if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enableSSL') && !CRM_Utils_System::isSSL() && strtolower(CRM_Utils_Array::value('X_FORWARDED_PROTO', CRM_Utils_System::getRequestHeaders())) != 'https') {
         return civicrm_api3_create_error('System policy requires HTTPS.');
     }
     // Note: $cxn and cxnId are authenticated before router is called.
     $dao = new CRM_Cxn_DAO_Cxn();
     $dao->cxn_id = $cxn['cxnId'];
     if (empty($cxn['cxnId']) || !$dao->find(TRUE) || !$dao->cxn_id) {
         return civicrm_api3_create_error('Failed to lookup connection authorizations.');
     }
     if (!$dao->is_active) {
         return civicrm_api3_create_error('Connection is inactive.');
     }
     if (!is_string($entity) || !is_string($action) || !is_array($params)) {
         return civicrm_api3_create_error('API parameters are malformed.');
     }
     if (empty($cxn['perm']['api']) || !is_array($cxn['perm']['api']) || empty($cxn['perm']['grant']) || !(is_array($cxn['perm']['grant']) || is_string($cxn['perm']['grant']))) {
         return civicrm_api3_create_error('Connection has no permissions.');
     }
     $whitelist = \Civi\API\WhitelistRule::createAll($cxn['perm']['api']);
     \Civi::service('dispatcher')->addSubscriber(new \Civi\API\Subscriber\WhitelistSubscriber($whitelist));
     CRM_Core_Config::singleton()->userPermissionTemp = new CRM_Core_Permission_Temp();
     if ($cxn['perm']['grant'] === '*') {
         CRM_Core_Config::singleton()->userPermissionTemp->grant($SUPER_PERM);
     } else {
         CRM_Core_Config::singleton()->userPermissionTemp->grant($cxn['perm']['grant']);
     }
     $params['check_permissions'] = 'whitelist';
     return civicrm_api($entity, $action, $params);
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:41,代码来源:ApiRouter.php


示例2: run

function run()
{
    session_start();
    require_once '../civicrm.config.php';
    require_once 'CRM/Core/Config.php';
    $config = CRM_Core_Config::singleton();
    require_once 'Console/Getopt.php';
    $shortOptions = "n:p:k:pre";
    $longOptions = array('name=', 'pass=', 'key=', 'prefix=');
    $getopt = new Console_Getopt();
    $args = $getopt->readPHPArgv();
    array_shift($args);
    list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions);
    $vars = array('name' => 'n', 'pass' => 'p', 'key' => 'k', 'prefix' => 'pre');
    foreach ($vars as $var => $short) {
        ${$var} = NULL;
        foreach ($valid as $v) {
            if ($v[0] == $short || $v[0] == "--{$var}") {
                ${$var} = $v[1];
                break;
            }
        }
        if (!${$var}) {
            ${$var} = CRM_Utils_Array::value($var, $_REQUEST);
        }
        $_REQUEST[$var] = ${$var};
    }
    // this does not return on failure
    // require_once 'CRM/Utils/System.php';
    CRM_Utils_System::authenticateScript(TRUE, $name, $pass);
    //log the execution of script
    CRM_Core_Error::debug_log_message('NormalizePhone.php');
    // process all phones
    processPhones($config, $prefix);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:35,代码来源:NormalizePhone.php


示例3: where

 /**
  * Method to build where part of query
  */
 function where()
 {
     $clauses = array();
     foreach ($this->_columns as $tableName => $table) {
         if (array_key_exists('filters', $table)) {
             foreach ($table['filters'] as $fieldName => $field) {
                 $clause = NULL;
                 $op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
                 // if user id value contains 0 for current user, replace value with current user
                 if ($fieldName == 'account_id') {
                     foreach ($this->_params['account_id_value'] as $paramKey => $userIdValue) {
                         if ($userIdValue == 0) {
                             $session = CRM_Core_Session::singleton();
                             $this->_params['account_id_value'][$paramKey] = $session->get('userID');
                         }
                     }
                 }
                 $clause = $this->whereClause($field, $op, CRM_Utils_Array::value("{$fieldName}_value", $this->_params), CRM_Utils_Array::value("{$fieldName}_min", $this->_params), CRM_Utils_Array::value("{$fieldName}_max", $this->_params));
                 if (!empty($clause)) {
                     $clauses[] = $clause;
                 }
             }
         }
     }
     if (empty($clauses)) {
         $this->_where = "";
     } else {
         $this->_where = "WHERE " . implode(' AND ', $clauses);
     }
 }
开发者ID:PUMNL,项目名称:nl.pum.casereports,代码行数:33,代码来源:Opportunities.php


示例4: select

 function select()
 {
     $select = array();
     $this->_columnHeaders = array();
     foreach ($this->_columns as $tableName => $table) {
         if (array_key_exists('fields', $table)) {
             foreach ($table['fields'] as $fieldName => $field) {
                 if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
                     if ($tableName == 'civicrm_email') {
                         $this->_emailField = TRUE;
                     } elseif ($tableName == 'civicrm_phone') {
                         $this->_phoneField = TRUE;
                     } elseif ($tableName == 'civicrm_country') {
                         $this->_countryField = TRUE;
                     }
                     $alias = "{$tableName}_{$fieldName}";
                     $select[] = "{$field['dbAlias']} as {$alias}";
                     $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
                     $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
                     $this->_selectAliases[] = $alias;
                 }
             }
         }
     }
     $this->_select = "SELECT " . implode(', ', $select) . " ";
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:26,代码来源:Summary.php


示例5: setDefaultValues

 /**
  * Set default values for the form.
  * The default values are retrieved from the database.
  *
  *
  * @return void
  */
 public function setDefaultValues()
 {
     $defaults = $this->_values;
     if (empty($defaults['pdf_format_id'])) {
         $defaults['pdf_format_id'] = 'null';
     }
     $this->_workflow_id = CRM_Utils_Array::value('workflow_id', $defaults);
     $this->assign('workflow_id', $this->_workflow_id);
     if ($this->_action & CRM_Core_Action::ADD) {
         $defaults['is_active'] = 1;
         //set the context for redirection after form submit or cancel
         $session = CRM_Core_Session::singleton();
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/messageTemplates', 'selectedChild=user&reset=1'));
     }
     // FIXME: we need to fix the Cancel button here as we don’t know whether it’s a workflow template in buildQuickForm()
     if ($this->_action & CRM_Core_Action::UPDATE) {
         if ($this->_workflow_id) {
             $selectedChild = 'workflow';
         } else {
             $selectedChild = 'user';
         }
         $cancelURL = CRM_Utils_System::url('civicrm/admin/messageTemplates', "selectedChild={$selectedChild}&reset=1");
         $cancelURL = str_replace('&', '&', $cancelURL);
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"))));
     }
     return $defaults;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:34,代码来源:MessageTemplates.php


示例6: importableFields

 static function importableFields($contactType = 'HRJobContractRevision', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'HRJobContractRevision';
     }
     $cacheKeyString = "";
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $showAll ? '_1' : '_0';
     $cacheKeyString .= $isProfile ? '_1' : '_0';
     $cacheKeyString .= $checkPermission ? '_1' : '_0';
     $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
     if (!$fields) {
         $fields = CRM_Hrjobcontract_DAO_HRJobContractRevision::import();
         $fields = array_merge($fields, CRM_Hrjobcontract_DAO_HRJobContractRevision::import());
         //Sorting fields in alphabetical order(CRM-1507)
         $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title');
         $fields = CRM_Utils_Array::index(array('name'), $fields);
         CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
     }
     self::$_importableFields[$cacheKeyString] = $fields;
     if (!$isProfile) {
         $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:25,代码来源:HRJobContractRevision.php


示例7: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 static function buildQuickForm(&$form)
 {
     // required for subsequent AJAX requests.
     $ajaxRequestBlocks = array();
     $generateAjaxRequest = 0;
     //build 1 instance of all blocks, without using ajax ...
     foreach ($form->_blocks as $blockName => $label) {
         require_once str_replace('_', DIRECTORY_SEPARATOR, 'CRM_Contact_Form_Edit_' . $blockName) . '.php';
         $name = strtolower($blockName);
         $instances = array(1);
         if (CRM_Utils_Array::value($name, $_POST) && is_array($_POST[$name])) {
             $instances = array_keys($_POST[$name]);
         } elseif (property_exists($form, '_values') && CRM_Utils_Array::value($name, $form->_values) && is_array($form->_values[$name])) {
             $instances = array_keys($form->_values[$name]);
         }
         foreach ($instances as $instance) {
             if ($instance == 1) {
                 $form->assign('addBlock', FALSE);
                 $form->assign('blockId', $instance);
             } else {
                 //we are going to build other block instances w/ AJAX
                 $generateAjaxRequest++;
                 $ajaxRequestBlocks[$blockName][$instance] = TRUE;
             }
             $form->set($blockName . '_Block_Count', $instance);
             $formName = 'CRM_Contact_Form_Edit_' . $blockName;
             $formName::buildQuickForm($form);
         }
     }
     //assign to generate AJAX request for building extra blocks.
     $form->assign('generateAjaxRequest', $generateAjaxRequest);
     $form->assign('ajaxRequestBlocks', $ajaxRequestBlocks);
 }
开发者ID:hguru,项目名称:224Civi,代码行数:39,代码来源:Location.php


示例8: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Core_BAO_LocationType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Location type has been deleted.'));
         return;
     }
     // store the submitted values in an array
     $params = $this->exportValues();
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
     $params['is_default'] = CRM_Utils_Array::value('is_default', $params, false);
     // action is taken depending upon the mode
     $locationType =& new CRM_Core_DAO_LocationType();
     $locationType->name = $params['name'];
     $locationType->vcard_name = $params['vcard_name'];
     $locationType->description = $params['description'];
     $locationType->is_active = $params['is_active'];
     $locationType->is_default = $params['is_default'];
     if ($params['is_default']) {
         $query = "UPDATE civicrm_location_type SET is_default = 0";
         CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $locationType->id = $this->_id;
     }
     $locationType->save();
     CRM_Core_Session::setStatus(ts('The location type \'%1\' has been saved.', array(1 => $locationType->name)));
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:34,代码来源:LocationType.php


示例9: 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


示例10: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     CRM_Utils_System::flushCache('CRM_Core_DAO_LocationType');
     if ($this->_action & CRM_Core_Action::DELETE) {
         CRM_Core_BAO_LocationType::del($this->_id);
         CRM_Core_Session::setStatus(ts('Selected Location type has been deleted.'), ts('Record Deleted'), 'success');
         return;
     }
     // store the submitted values in an array
     $params = $this->exportValues();
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
     $params['is_default'] = CRM_Utils_Array::value('is_default', $params, FALSE);
     // action is taken depending upon the mode
     $locationType = new CRM_Core_DAO_LocationType();
     $locationType->name = $params['name'];
     $locationType->display_name = $params['display_name'];
     $locationType->vcard_name = $params['vcard_name'];
     $locationType->description = $params['description'];
     $locationType->is_active = $params['is_active'];
     $locationType->is_default = $params['is_default'];
     if ($params['is_default']) {
         $query = "UPDATE civicrm_location_type SET is_default = 0";
         CRM_Core_DAO::executeQuery($query);
     }
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $locationType->id = $this->_id;
     }
     $locationType->save();
     CRM_Core_Session::setStatus(ts("The location type '%1' has been saved.", array(1 => $locationType->name)), ts('Saved'), 'success');
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:33,代码来源:LocationType.php


示例11: selectUnselectRelationships

 /**
  * Used to store selected contacts across multiple pages in advanced search.
  */
 public static function selectUnselectRelationships()
 {
     $name = CRM_Utils_Array::value('name', $_REQUEST);
     $cacheKey = CRM_Utils_Array::value('qfKey', $_REQUEST);
     $state = CRM_Utils_Array::value('state', $_REQUEST, 'checked');
     $variableType = CRM_Utils_Array::value('variableType', $_REQUEST, 'single');
     $actionToPerform = CRM_Utils_Array::value('action', $_REQUEST, 'select');
     if ($variableType == 'multiple') {
         // action post value only works with multiple type variable
         if ($name) {
             //multiple names like mark_x_1-mark_x_2 where 1,2 are cids
             $elements = explode('-', $name);
             foreach ($elements as $key => $element) {
                 $elements[$key] = self::_convertToId($element);
             }
             CRM_Core_BAO_PrevNextCache::markSelection($cacheKey, $actionToPerform, $elements, 'civicrm_relationship');
         } else {
             CRM_Core_BAO_PrevNextCache::markSelection($cacheKey, $actionToPerform, NULL, 'civicrm_relationship');
         }
     } elseif ($variableType == 'single') {
         $cId = self::_convertToId($name);
         $action = $state == 'checked' ? 'select' : 'unselect';
         CRM_Core_BAO_PrevNextCache::markSelection($cacheKey, $action, $cId, 'civicrm_relationship');
     }
     $contactIds = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey, 'get', 'civicrm_relationship');
     $countSelectionCids = count($contactIds[$cacheKey]);
     $arrRet = array('getCount' => $countSelectionCids);
     CRM_Utils_JSON::output($arrRet);
 }
开发者ID:Chirojeugd-Vlaanderen,项目名称:civicrm-relationship-entity,代码行数:32,代码来源:AJAX.php


示例12: select

 function select()
 {
     $select = array();
     $this->_columnHeaders = array();
     foreach ($this->_columns as $tableName => $table) {
         if (array_key_exists('fields', $table)) {
             foreach ($table['fields'] as $fieldName => $field) {
                 if (!empty($field['required']) || !empty($this->_params['fields'][$fieldName])) {
                     if ($tableName == 'civicrm_hrjobcontract_leave' && $fieldName == 'leave_leave_type') {
                         $select[] = "GROUP_CONCAT(DISTINCT hrjobcontract_leave_civireport.leave_type SEPARATOR ',') AS {$tableName}_{$fieldName}";
                     } elseif ($tableName == 'civicrm_hrjobcontract_leave' && $fieldName == 'leave_leave_amount') {
                         $select[] = "GROUP_CONCAT(DISTINCT hrjobcontract_leave_civireport.leave_type , ':', hrjobcontract_leave_civireport.leave_amount SEPARATOR ',') AS {$tableName}_{$fieldName}";
                     } elseif ($tableName == 'civicrm_hrjobcontract_health' && $fieldName == 'health_provider') {
                         $select[] = "CONCAT({$this->_aliases['civicrm_contact']}_health1.sort_name, ' (InternalID: ', hrjobcontract_health_civireport.provider , ', Email: ', COALESCE({$this->_aliases['civicrm_email']}_health1.email, '-'), ', ExternalID: ', COALESCE({$this->_aliases['civicrm_contact']}_health1.external_identifier, '-'), ')') AS {$tableName}_{$fieldName}";
                     } elseif ($tableName == 'civicrm_hrjobcontract_health' && $fieldName == 'health_provider_life_insurance') {
                         $select[] = "CONCAT({$this->_aliases['civicrm_contact']}_health2.sort_name, ' (InternalID: ', hrjobcontract_health_civireport.provider_life_insurance , ', Email: ', COALESCE({$this->_aliases['civicrm_email']}_health2.email, '-'), ', ExternalID: ', COALESCE({$this->_aliases['civicrm_contact']}_health2.external_identifier, '-'), ')') AS {$tableName}_{$fieldName}";
                     } else {
                         $alias = "{$tableName}_{$fieldName}";
                         $select[] = "{$field['dbAlias']} as {$alias}";
                     }
                     $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
                     $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title'];
                     $this->_selectAliases[] = $alias;
                 }
             }
         }
     }
     $this->_select = "SELECT " . implode(', ', $select) . " ";
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:29,代码来源:Summary.php


示例13: add

 /**
  * takes an associative array and creates a contact object
  *
  * the function extract all the params it needs to initialize the create a
  * contact object. the params array could contain additional unused name/value
  * pairs
  *
  * @param array  $params (reference ) an assoc array of name/value pairs
  * @param array $ids    the array that holds all the db ids
  *
  * @return object CRM_Contact_BAO_Household object
  * @access public
  * @static
  */
 function add(&$params, &$ids)
 {
     $household =& new CRM_Contact_BAO_Household();
     $household->copyValues($params);
     $household->id = CRM_Utils_Array::value('household', $ids);
     return $household->save();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:21,代码来源:Household.php


示例14: create

 /**
  * process website
  *
  * @param array $params associated array
  * @param int   $contactID contact id
  *
  * @return void
  * @access public
  * @static
  */
 static function create(&$params, $contactID, $skipDelete)
 {
     if (empty($params)) {
         return FALSE;
     }
     $ids = self::allWebsites($contactID);
     foreach ($params as $key => $values) {
         $websiteId = CRM_Utils_Array::value('id', $values);
         if ($websiteId) {
             if (array_key_exists($websiteId, $ids)) {
                 unset($ids[$websiteId]);
             } else {
                 unset($values['id']);
             }
         }
         if (!CRM_Utils_Array::value('id', $values) && is_array($ids) && !empty($ids)) {
             foreach ($ids as $id => $value) {
                 if ($value['website_type_id'] == $values['website_type_id']) {
                     $values['id'] = $id;
                     unset($ids[$id]);
                     break;
                 }
             }
         }
         $values['contact_id'] = $contactID;
         self::add($values);
     }
     if ($skipDelete && !empty($ids)) {
         self::del(array_keys($ids));
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:41,代码来源:Website.php


示例15: run

 public function run()
 {
     // lets get around the time limit issue if possible for upgrades
     if (!ini_get('safe_mode')) {
         set_time_limit(0);
     }
     $upgrade = new CRM_Upgrade_Form();
     list($currentVer, $latestVer) = $upgrade->getUpgradeVersions();
     CRM_Utils_System::setTitle(ts('Upgrade CiviCRM to Version %1', array(1 => $latestVer)));
     $template = CRM_Core_Smarty::singleton();
     $template->assign('pageTitle', ts('Upgrade CiviCRM to Version %1', array(1 => $latestVer)));
     $template->assign('cancelURL', CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
     $action = CRM_Utils_Array::value('action', $_REQUEST, 'intro');
     switch ($action) {
         case 'intro':
             $this->runIntro();
             break;
         case 'begin':
             $this->runBegin();
             break;
         case 'finish':
             $this->runFinish();
             break;
         default:
             CRM_Core_Error::fatal(ts('Unrecognized upgrade action'));
     }
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:27,代码来源:Upgrade.php


示例16: setDefaultValues

 /**
  * Set default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  *
  * @return array
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         if (!empty($this->_BAOName)) {
             $baoName = $this->_BAOName;
             $baoName::retrieve($params, $defaults);
         }
     }
     if ($this->_action == CRM_Core_Action::DELETE && !empty($defaults['name'])) {
         $this->assign('delName', $defaults['name']);
     } elseif ($this->_action == CRM_Core_Action::ADD) {
         $condition = " AND is_default = 1";
         $values = CRM_Core_OptionGroup::values('financial_account_type', FALSE, FALSE, FALSE, $condition);
         $defaults['financial_account_type_id'] = array_keys($values);
         $defaults['is_active'] = 1;
     } elseif ($this->_action & CRM_Core_Action::UPDATE) {
         if (!empty($defaults['contact_id']) || !empty($defaults['created_id'])) {
             $contactID = !empty($defaults['created_id']) ? $defaults['created_id'] : $defaults['contact_id'];
             $this->assign('created_id', $contactID);
             $this->assign('organisationId', $contactID);
         }
         if ($parentId = CRM_Utils_Array::value('parent_id', $defaults)) {
             $this->assign('parentId', $parentId);
         }
     }
     return $defaults;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:36,代码来源:Form.php


示例17: createQuery

 /**
  * Generate a query to locate recipients who match the given
  * schedule.
  *
  * @param \CRM_Core_DAO_ActionSchedule $schedule
  *   The schedule as configured by the administrator.
  * @param string $phase
  *   See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
  * @param array $defaultParams
  *
  * @return \CRM_Utils_SQL_Select
  * @see RecipientBuilder
  */
 public function createQuery($schedule, $phase, $defaultParams)
 {
     $selectedValues = (array) \CRM_Utils_Array::explodePadded($schedule->entity_value);
     $selectedStatuses = (array) \CRM_Utils_Array::explodePadded($schedule->entity_status);
     $query = \CRM_Utils_SQL_Select::from("{$this->entity} e")->param($defaultParams);
     $query['casAddlCheckFrom'] = 'civicrm_membership e';
     $query['casContactIdField'] = 'e.contact_id';
     $query['casEntityIdField'] = 'e.id';
     $query['casContactTableAlias'] = NULL;
     $query['casDateField'] = str_replace('membership_', 'e.', $schedule->start_action_date);
     // FIXME: Numbers should be constants.
     if (in_array(2, $selectedStatuses)) {
         //auto-renew memberships
         $query->where("e.contribution_recur_id IS NOT NULL");
     } elseif (in_array(1, $selectedStatuses)) {
         $query->where("e.contribution_recur_id IS NULL");
     }
     if (!empty($selectedValues)) {
         $query->where("e.membership_type_id IN (@memberTypeValues)")->param('memberTypeValues', $selectedValues);
     } else {
         $query->where("e.membership_type_id IS NULL");
     }
     $query->where("( e.is_override IS NULL OR e.is_override = 0 )");
     $query->merge($this->prepareMembershipPermissionsFilter());
     $query->where("e.status_id IN (#memberStatus)")->param('memberStatus', \CRM_Member_PseudoConstant::membershipStatus(NULL, "(is_current_member = 1 OR name = 'Expired')", 'id'));
     // Why is this only for civicrm_membership?
     if ($schedule->start_action_date && $schedule->is_repeat == FALSE) {
         $query['casUseReferenceDate'] = TRUE;
     }
     return $query;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:44,代码来源:ActionMapping.php


示例18: add

 /**
  * Takes an associative array and adds email.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @return object
  *   CRM_Core_BAO_Email object on success, null otherwise
  */
 public static function add(&$params)
 {
     $hook = empty($params['id']) ? 'create' : 'edit';
     CRM_Utils_Hook::pre($hook, 'Email', CRM_Utils_Array::value('id', $params), $params);
     $email = new CRM_Core_DAO_Email();
     $email->copyValues($params);
     // lower case email field to optimize queries
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $email->email = $strtolower($email->email);
     /*
      * since we're setting bulkmail for 1 of this contact's emails, first reset all their other emails to is_bulkmail false
      *  We shouldn't not set the current email to false even though we
      *  are about to reset it to avoid contaminating the changelog if logging is enabled
      * (only 1 email address can have is_bulkmail = true)
      */
     if ($email->is_bulkmail != 'null' && $params['contact_id'] && !self::isMultipleBulkMail()) {
         $sql = "\nUPDATE civicrm_email\nSET    is_bulkmail = 0\nWHERE  contact_id = {$params['contact_id']}\n";
         if ($hook == 'edit') {
             $sql .= " AND id <> {$params['id']}";
         }
         CRM_Core_DAO::executeQuery($sql);
     }
     // handle if email is on hold
     self::holdEmail($email);
     $email->save();
     if ($email->is_primary) {
         // update the UF user email if that has changed
         CRM_Core_BAO_UFMatch::updateUFName($email->contact_id);
     }
     CRM_Utils_Hook::post($hook, 'Email', $email->id, $email);
     return $email;
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:41,代码来源:Email.php


示例19: format

 /**
  * format a monetary string
  *
  * Format a monetary string basing on the amount provided,
  * ISO currency code provided and a format string consisting of:
  *
  * %a - the formatted amount
  * %C - the currency ISO code (e.g., 'USD') if provided
  * %c - the currency symbol (e.g., '$') if available
  *
  * @param float  $amount    the monetary amount to display (1234.56)
  * @param string $currency  the three-letter ISO currency code ('USD')
  * @param string $format    the desired currency format
  *
  * @return string  formatted monetary string
  *
  * @static
  */
 static function format($amount, $currency = null, $format = null)
 {
     if (CRM_Utils_System::isNull($amount)) {
         return '';
     }
     $config =& CRM_Core_Config::singleton();
     if (!self::$_currencySymbols) {
         require_once "CRM/Core/PseudoConstant.php";
         $currencySymbolName = CRM_Core_PseudoConstant::currencySymbols('name');
         $currencySymbol = CRM_Core_PseudoConstant::currencySymbols();
         self::$_currencySymbols = array_combine($currencySymbolName, $currencySymbol);
     }
     if (!$currency) {
         $currency = $config->defaultCurrency;
     }
     if (!$format) {
         $format = $config->moneyformat;
     }
     // money_format() exists only in certain PHP install (CRM-650)
     if (is_numeric($amount) and function_exists('money_format')) {
         $amount = money_format($config->moneyvalueformat, $amount);
     }
     $replacements = array('%a' => $amount, '%C' => $currency, '%c' => CRM_Utils_Array::value($currency, self::$_currencySymbols, $currency));
     return strtr($format, $replacements);
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:43,代码来源:Money.php


示例20: browse

 /**
  * Browse all mail settings.
  */
 public function browse()
 {
     //get all mail settings.
     $allMailSettings = array();
     $mailSetting = new CRM_Core_DAO_MailSettings();
     $allProtocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
     //multi-domain support for mail settings. CRM-5244
     $mailSetting->domain_id = CRM_Core_Config::domainID();
     //find all mail settings.
     $mailSetting->find();
     while ($mailSetting->fetch()) {
         //replace protocol value with name
         $mailSetting->protocol = CRM_Utils_Array::value($mailSetting->protocol, $allProtocols);
         CRM_Core_DAO::storeValues($mailSetting, $allMailSettings[$mailSetting->id]);
         //form all action links
         $action = array_sum(array_keys($this->links()));
         // disallow the DELETE action for the default set of settings
         if ($mailSetting->is_default) {
             $action &= ~CRM_Core_Action::DELETE;
         }
         //add action links.
         $allMailSettings[$mailSetting->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $mailSetting->id), ts('more'), FALSE, 'mailSetting.manage.action', 'MailSetting', $mailSetting->id);
     }
     $this->assign('rows', $allMailSettings);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:28,代码来源:MailSettings.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Utils_Cache类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Utils_Address类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap