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


PHP CRM_Core_DAO_UFGroup::free方法代码示例

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


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

示例1: preProcess

 /**
  * Pre processing work done here.
  *
  * gets session variables for table name, id of entity in table, type of entity and stores them.
  *
  * @param
  *
  * @return void
  */
 public function preProcess()
 {
     $this->_id = $this->get('id');
     $this->_profileIds = $this->get('profileIds');
     $this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     //unset from session when $_GET doesn't have it
     //except when the form is submitted
     if (empty($_POST)) {
         if (!array_key_exists('multiRecord', $_GET)) {
             $this->set('multiRecord', NULL);
         }
         if (!array_key_exists('recordId', $_GET)) {
             $this->set('recordId', NULL);
         }
     }
     $this->_session = CRM_Core_Session::singleton();
     $this->_currentUserID = $this->_session->get('userID');
     if ($this->_mode == self::MODE_EDIT) {
         //specifies the action being done on a multi record field
         $multiRecordAction = CRM_Utils_Request::retrieve('multiRecord', 'String', $this);
         $this->_multiRecord = !is_numeric($multiRecordAction) ? CRM_Core_Action::resolve($multiRecordAction) : $multiRecordAction;
         if ($this->_multiRecord) {
             $this->set('multiRecord', $this->_multiRecord);
         }
         if ($this->_multiRecord && !in_array($this->_multiRecord, array(CRM_Core_Action::UPDATE, CRM_Core_Action::ADD, CRM_Core_Action::DELETE))) {
             CRM_Core_Error::fatal(ts('Proper action not specified for this custom value record profile'));
         }
     }
     $this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
     $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0));
     if (count($gids) > 1 && !$this->_profileIds && empty($this->_profileIds)) {
         if (!empty($gids)) {
             foreach ($gids as $pfId) {
                 $this->_profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
             }
         }
         // check if we are rendering mixed profiles
         if (CRM_Core_BAO_UFGroup::checkForMixProfiles($this->_profileIds)) {
             CRM_Core_Error::fatal(ts('You cannot combine profiles of multiple types.'));
         }
         // for now consider 1'st profile as primary profile and validate it
         // i.e check for profile type etc.
         // FIX ME: validations for other than primary
         $this->_gid = $this->_profileIds[0];
         $this->set('gid', $this->_gid);
         $this->set('profileIds', $this->_profileIds);
     }
     if (!$this->_gid) {
         $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
         $this->set('gid', $this->_gid);
     }
     $this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
     if (is_numeric($this->_activityId)) {
         $latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
         if ($latestRevisionId) {
             $this->_activityId = $latestRevisionId;
         }
     }
     $this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
     //get values for ufGroupName, captch and dupe update.
     if ($this->_gid) {
         $dao = new CRM_Core_DAO_UFGroup();
         $dao->id = $this->_gid;
         if ($dao->find(TRUE)) {
             $this->_isUpdateDupe = $dao->is_update_dupe;
             $this->_isAddCaptcha = $dao->add_captcha;
             $this->_ufGroup = (array) $dao;
         }
         $dao->free();
         if (!CRM_Utils_Array::value('is_active', $this->_ufGroup)) {
             CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', array(1 => $this->_gid)));
         }
     }
     $this->assign('ufGroupName', $this->_ufGroup['name']);
     $gids = empty($this->_profileIds) ? $this->_gid : $this->_profileIds;
     // if we dont have a gid use the default, else just use that specific gid
     if (($this->_mode == self::MODE_REGISTER || $this->_mode == self::MODE_CREATE) && !$this->_gid) {
         $this->_ctype = CRM_Utils_Request::retrieve('ctype', 'String', $this, FALSE, 'Individual', 'REQUEST');
         $this->_fields = CRM_Core_BAO_UFGroup::getRegistrationFields($this->_action, $this->_mode, $this->_ctype);
     } elseif ($this->_mode == self::MODE_SEARCH) {
         $this->_fields = CRM_Core_BAO_UFGroup::getListingFields($this->_action, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $gids, TRUE, NULL, $this->_skipPermission, CRM_Core_Permission::SEARCH);
     } else {
         $this->_fields = CRM_Core_BAO_UFGroup::getFields($gids, FALSE, NULL, NULL, NULL, FALSE, NULL, $this->_skipPermission, NULL, $this->_action == CRM_Core_Action::ADD ? CRM_Core_Permission::CREATE : CRM_Core_Permission::EDIT);
         $multiRecordFieldListing = FALSE;
         //using selector for listing of multirecord fields
         if ($this->_mode == self::MODE_EDIT && $this->_gid) {
             CRM_Core_BAO_UFGroup::shiftMultiRecordFields($this->_fields, $this->_multiRecordFields);
             if ($this->_multiRecord) {
                 if ($this->_multiRecord != CRM_Core_Action::ADD) {
                     $this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
//.........这里部分代码省略.........
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:101,代码来源:Form.php

示例2: VARCHAR

 function upgrade_3_3_alpha1($rev)
 {
     $config = CRM_Core_Config::singleton();
     if ($config->userSystem->is_drupal) {
         // CRM-6426 - make civicrm profiles permissioned on drupal my account
         $config->userSystem->updateCategories();
     }
     // CRM-6846
     // insert name column for custom field table.
     // make sure name for custom field, group and
     // profile should be unique and properly munged.
     $colQuery = 'ALTER TABLE `civicrm_custom_field` ADD `name` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `custom_group_id` ';
     CRM_Core_DAO::executeQuery($colQuery, CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
     $customFldCntQuery = 'select count(*) from civicrm_custom_field where name like %1 and id != %2';
     $customField = new CRM_Core_DAO_CustomField();
     $customField->selectAdd();
     $customField->selectAdd('id, label');
     $customField->find();
     while ($customField->fetch()) {
         $name = CRM_Utils_String::munge($customField->label, '_', 64);
         $fldCnt = CRM_Core_DAO::singleValueQuery($customFldCntQuery, array(1 => array($name, 'String'), 2 => array($customField->id, 'Integer')), TRUE, FALSE);
         if ($fldCnt) {
             $name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
         }
         $customFieldQuery = "\nUpdate `civicrm_custom_field`\nSET `name` = %1\nWHERE id = %2\n";
         $customFieldParams = array(1 => array($name, 'String'), 2 => array($customField->id, 'Integer'));
         CRM_Core_DAO::executeQuery($customFieldQuery, $customFieldParams, TRUE, NULL, FALSE, FALSE);
     }
     $customField->free();
     $customGrpCntQuery = 'select count(*) from civicrm_custom_group where name like %1 and id != %2';
     $customGroup = new CRM_Core_DAO_CustomGroup();
     $customGroup->selectAdd();
     $customGroup->selectAdd('id, title');
     $customGroup->find();
     while ($customGroup->fetch()) {
         $name = CRM_Utils_String::munge($customGroup->title, '_', 64);
         $grpCnt = CRM_Core_DAO::singleValueQuery($customGrpCntQuery, array(1 => array($name, 'String'), 2 => array($customGroup->id, 'Integer')));
         if ($grpCnt) {
             $name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
         }
         CRM_Core_DAO::setFieldValue('CRM_Core_DAO_CustomGroup', $customGroup->id, 'name', $name);
     }
     $customGroup->free();
     $ufGrpCntQuery = 'select count(*) from civicrm_uf_group where name like %1 and id != %2';
     $ufGroup = new CRM_Core_DAO_UFGroup();
     $ufGroup->selectAdd();
     $ufGroup->selectAdd('id, title');
     $ufGroup->find();
     while ($ufGroup->fetch()) {
         $name = CRM_Utils_String::munge($ufGroup->title, '_', 64);
         $ufGrpCnt = CRM_Core_DAO::singleValueQuery($ufGrpCntQuery, array(1 => array($name, 'String'), 2 => array($ufGroup->id, 'Integer')));
         if ($ufGrpCnt) {
             $name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
         }
         CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $ufGroup->id, 'name', $name);
     }
     $ufGroup->free();
     $upgrade = new CRM_Upgrade_Form();
     $upgrade->processSQL($rev);
     // now modify the config so that the directories are stored in option group/value
     // CRM-6914
     // require_once 'CRM/Core/BAO/ConfigSetting.php';
     // $params = array( );
     // CRM_Core_BAO_ConfigSetting::add( $parambs );
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:65,代码来源:ThreeThree.php

示例3: preProcess

 /** 
  * pre processing work done here. 
  * 
  * gets session variables for table name, id of entity in table, type of entity and stores them. 
  * 
  * @param  
  * @return void 
  * 
  * @access public 
  */
 function preProcess()
 {
     require_once 'CRM/Core/BAO/UFGroup.php';
     require_once "CRM/Core/BAO/UFField.php";
     $this->_id = $this->get('id');
     $this->_gid = $this->get('gid');
     $this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
     if (!$this->_gid) {
         $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, false, 0, 'GET');
     }
     //get values for captch and dupe update.
     if ($this->_gid) {
         $dao = new CRM_Core_DAO_UFGroup();
         $dao->id = $this->_gid;
         if ($dao->find(true)) {
             $this->_isUpdateDupe = $dao->is_update_dupe;
             $this->_isAddCaptcha = $dao->add_captcha;
         }
         $dao->free();
     }
     // if we dont have a gid use the default, else just use that specific gid
     if (($this->_mode == self::MODE_REGISTER || $this->_mode == self::MODE_CREATE) && !$this->_gid) {
         $this->_ctype = CRM_Utils_Request::retrieve('ctype', 'String', $this, false, 'Individual', 'REQUEST');
         $this->_fields = CRM_Core_BAO_UFGroup::getRegistrationFields($this->_action, $this->_mode, $this->_ctype);
     } else {
         if ($this->_mode == self::MODE_SEARCH) {
             $this->_fields = CRM_Core_BAO_UFGroup::getListingFields($this->_action, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, false, $this->_gid, true, null, $this->_skipPermission, CRM_Core_Permission::SEARCH);
         } else {
             $this->_fields = CRM_Core_BAO_UFGroup::getFields($this->_gid, false, null, null, null, false, null, $this->_skipPermission, null, $this->_action == CRM_Core_Action::ADD ? CRM_Core_Permission::CREATE : CRM_Core_Permission::EDIT);
             ///is profile double-opt process configurablem, key
             ///should be present in civicrm.settting.php file
             $config =& CRM_Core_Config::singleton();
             if ($config->profileDoubleOptIn && CRM_Utils_Array::value('group', $this->_fields)) {
                 $emailField = false;
                 foreach ($this->_fields as $name => $values) {
                     if (substr($name, 0, 6) == 'email-') {
                         $emailField = true;
                     }
                 }
                 if (!$emailField) {
                     $session =& CRM_Core_Session::singleton();
                     $status = ts("Email field should be included in profile if you want to use Group(s) when Profile double-opt in process is enabled.");
                     $session->setStatus($status);
                 }
             }
         }
     }
     if (!is_array($this->_fields)) {
         $session =& CRM_Core_Session::singleton();
         CRM_Core_Session::setStatus(ts('This feature is not currently available.'));
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm', 'reset=1'));
     }
     if ($this->_mode != self::MODE_SEARCH) {
         CRM_Core_BAO_UFGroup::setRegisterDefaults($this->_fields, $defaults);
         $this->setDefaults($defaults);
     }
     $this->setDefaultsValues();
 }
开发者ID:bhirsch,项目名称:civicrm,代码行数:70,代码来源:Form.php

示例4: upgrade_3_4_3

 /**
  * @param $rev
  */
 public function upgrade_3_4_3($rev)
 {
     // CRM-8147, update group_type for uf groups, check and add component field types
     $ufGroups = new CRM_Core_DAO_UFGroup();
     $ufGroups->find();
     $skipGroupTypes = array('Individual,Contact', 'Organization,Contact', 'Household,Contact', 'Contact', 'Individual', 'Organization', 'Household');
     while ($ufGroups->fetch()) {
         if (!in_array($ufGroups->group_type, $skipGroupTypes)) {
             $groupTypes = CRM_Core_BAO_UFGroup::calculateGroupType($ufGroups->id, TRUE);
             CRM_Core_BAO_UFGroup::updateGroupTypes($ufGroups->id, $groupTypes);
         }
     }
     $ufGroups->free();
     // CRM-8134 add phone_ext column if it wasn't already added for this site in 3.3.7 upgrade (3.3.7 was released after 3.4.0)
     $dao = new CRM_Contact_DAO_Contact();
     $dbName = $dao->_database;
     $chkExtQuery = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %1\n                        AND TABLE_NAME = 'civicrm_phone' AND COLUMN_NAME = 'phone_ext'";
     $extensionExists = CRM_Core_DAO::singleValueQuery($chkExtQuery, array(1 => array($dbName, 'String')), TRUE, FALSE);
     if (!$extensionExists) {
         $colQuery = 'ALTER TABLE `civicrm_phone` ADD `phone_ext` VARCHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `phone` ';
         CRM_Core_DAO::executeQuery($colQuery);
     }
     $sql = "SELECT id FROM civicrm_location_type WHERE name = 'Main'";
     if (!CRM_Core_DAO::singleValueQuery($sql)) {
         $query = "\nINSERT INTO civicrm_location_type ( name, description, is_reserved, is_active )\n     VALUES ( 'Main', 'Main office location', 0, 1 );";
         CRM_Core_DAO::executeQuery($query);
     }
     $upgrade = new CRM_Upgrade_Form();
     $upgrade->processSQL($rev);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:33,代码来源:ThreeFour.php

示例5: preProcess

 /**
  * pre processing work done here.
  *
  * gets session variables for table name, id of entity in table, type of entity and stores them.
  *
  * @param
  *
  * @return void
  *
  * @access public
  */
 function preProcess()
 {
     $this->_id = $this->get('id');
     $this->_gid = $this->get('gid');
     $this->_profileIds = $this->get('profileIds');
     $this->_grid = CRM_Utils_Request::retrieve('grid', 'Integer', $this);
     $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
     $this->_duplicateButtonName = $this->getButtonName('upload', 'duplicate');
     $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, FALSE, 0, 'GET'));
     if (count($gids) > 1 && !$this->_profileIds && empty($this->_profileIds)) {
         if (!empty($gids)) {
             foreach ($gids as $pfId) {
                 $this->_profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
             }
         }
         // check if we are rendering mixed profiles
         if (CRM_Core_BAO_UFGroup::checkForMixProfiles($this->_profileIds)) {
             CRM_Core_Error::fatal(ts('You cannot combine profiles of multiple types.'));
         }
         // for now consider 1'st profile as primary profile and validate it
         // i.e check for profile type etc.
         // FIX ME: validations for other than primary
         $this->_gid = $this->_profileIds[0];
         $this->set('gid', $this->_gid);
         $this->set('profileIds', $this->_profileIds);
     }
     if (!$this->_gid) {
         $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0, 'GET');
     }
     $this->_activityId = CRM_Utils_Request::retrieve('aid', 'Positive', $this, FALSE, 0, 'GET');
     if (is_numeric($this->_activityId)) {
         $latestRevisionId = CRM_Activity_BAO_Activity::getLatestActivityId($this->_activityId);
         if ($latestRevisionId) {
             $this->_activityId = $latestRevisionId;
         }
     }
     $this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid);
     //get values for captch and dupe update.
     if ($this->_gid) {
         $dao = new CRM_Core_DAO_UFGroup();
         $dao->id = $this->_gid;
         if ($dao->find(TRUE)) {
             $this->_isUpdateDupe = $dao->is_update_dupe;
             $this->_isAddCaptcha = $dao->add_captcha;
         }
         $dao->free();
     }
     if (empty($this->_profileIds)) {
         $gids = $this->_gid;
     } else {
         $gids = $this->_profileIds;
     }
     // if we dont have a gid use the default, else just use that specific gid
     if (($this->_mode == self::MODE_REGISTER || $this->_mode == self::MODE_CREATE) && !$this->_gid) {
         $this->_ctype = CRM_Utils_Request::retrieve('ctype', 'String', $this, FALSE, 'Individual', 'REQUEST');
         $this->_fields = CRM_Core_BAO_UFGroup::getRegistrationFields($this->_action, $this->_mode, $this->_ctype);
     } elseif ($this->_mode == self::MODE_SEARCH) {
         $this->_fields = CRM_Core_BAO_UFGroup::getListingFields($this->_action, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $gids, TRUE, NULL, $this->_skipPermission, CRM_Core_Permission::SEARCH);
     } else {
         $this->_fields = CRM_Core_BAO_UFGroup::getFields($gids, FALSE, NULL, NULL, NULL, FALSE, NULL, $this->_skipPermission, NULL, $this->_action == CRM_Core_Action::ADD ? CRM_Core_Permission::CREATE : CRM_Core_Permission::EDIT);
         // is profile double-opt in?
         if (CRM_Utils_Array::value('group', $this->_fields) && CRM_Core_BAO_UFGroup::isProfileDoubleOptin()) {
             $emailField = FALSE;
             foreach ($this->_fields as $name => $values) {
                 if (substr($name, 0, 6) == 'email-') {
                     $emailField = TRUE;
                 }
             }
             if (!$emailField) {
                 $session = CRM_Core_Session::singleton();
                 $status = ts("Email field should be included in profile if you want to use Group(s) when Profile double-opt in process is enabled.");
                 $session->setStatus($status);
             }
         }
     }
     if (!is_array($this->_fields)) {
         $session = CRM_Core_Session::singleton();
         CRM_Core_Session::setStatus(ts('This feature is not currently available.'));
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm', 'reset=1'));
     }
     if ($this->_mode != self::MODE_SEARCH) {
         CRM_Core_BAO_UFGroup::setRegisterDefaults($this->_fields, $defaults);
         $this->setDefaults($defaults);
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:96,代码来源:Form.php


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