本文整理汇总了PHP中CRM_Core_BAO_UFField::setUFField方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFField::setUFField方法的具体用法?PHP CRM_Core_BAO_UFField::setUFField怎么用?PHP CRM_Core_BAO_UFField::setUFField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFField
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFField::setUFField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setIsActive
/**
* update the is_active flag in the db
*
* @param int $id Id of the database record
* @param boolean $is_active Value we want to set the is_active field
*
* @return Object DAO object on sucess, null otherwise
*
* @access public
* @static
*/
static function setIsActive($id, $is_active)
{
require_once 'CRM/Core/BAO/UFField.php';
//enable-disable UFField
CRM_Core_BAO_UFField::setUFField($id, $is_active);
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_CustomField', $id, 'is_active', $is_active);
}
示例2: setUFFieldStatus
/**
* Enable/disable profile field given a custom group id
*
* @param int $customGroupId
* Custom group id.
* @param bool $is_active
* Value we want to set the is_active field.
*
* @return void
*/
public static function setUFFieldStatus($customGroupId, $is_active)
{
//find the profile id given custom group id
$queryString = "SELECT civicrm_custom_field.id as custom_field_id\n FROM civicrm_custom_field, civicrm_custom_group\n WHERE civicrm_custom_field.custom_group_id = civicrm_custom_group.id\n AND civicrm_custom_group.id = %1";
$p = array(1 => array($customGroupId, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($queryString, $p);
while ($dao->fetch()) {
//enable/ disable profile
CRM_Core_BAO_UFField::setUFField($dao->custom_field_id, $is_active);
}
}
示例3: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
*
* @param null
*
* @return void
* @access public
*/
function run()
{
require_once 'CRM/Core/BAO/CustomGroup.php';
// get the group id
$this->_gid = CRM_Utils_Request::retrieve('gid', $this);
$action = CRM_Utils_Request::retrieve('action', $this, false, 'browse');
// default to 'browse'
if ($action & CRM_CORE_ACTION_DELETE) {
$session =& CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/custom/group/field', 'reset=1&action=browse&gid=' . $this->_gid));
$controller =& new CRM_Core_Controller_Simple('CRM_Custom_Form_DeleteField', "Delete Cutom Field", $mode);
$id = CRM_Utils_Request::retrieve('id', $this, false, 0);
$controller->set('id', $id);
$controller->setEmbedded(true);
$controller->process();
$controller->run();
}
if ($this->_gid) {
$groupTitle = CRM_Core_BAO_CustomGroup::getTitle($this->_gid);
$this->assign('gid', $this->_gid);
$this->assign('groupTitle', $groupTitle);
CRM_Utils_System::setTitle(ts('%1 - Custom Fields', array(1 => $groupTitle)));
}
// get the requested action
// assign vars to templates
$this->assign('action', $action);
$id = CRM_Utils_Request::retrieve('id', $this, false, 0);
// what action to take ?
if ($action & (CRM_CORE_ACTION_UPDATE | CRM_CORE_ACTION_ADD)) {
$this->edit($action);
// no browse for edit/update/view
} else {
if ($action & CRM_CORE_ACTION_PREVIEW) {
$this->preview($id);
} else {
require_once 'CRM/Core/BAO/CustomField.php';
require_once 'CRM/Core/BAO/UFField.php';
if ($action & CRM_CORE_ACTION_DISABLE) {
CRM_Core_BAO_CustomField::setIsActive($id, 0);
CRM_Core_BAO_UFField::setUFField($id, 0);
} else {
if ($action & CRM_CORE_ACTION_ENABLE) {
CRM_Core_BAO_CustomField::setIsActive($id, 1);
CRM_Core_BAO_UFField::setUFField($id, 1);
}
}
$this->browse();
}
}
// Call the parents run method
parent::run();
}
示例4: setIsActive
/**
* Update the is_active flag in the db.
*
* @param int $id
* Id of the database record.
* @param bool $is_active
* Value we want to set the is_active field.
*
* @return Object
* DAO object on sucess, null otherwise
*
*/
public static function setIsActive($id, $is_active)
{
CRM_Utils_System::flushCache();
//enable-disable CustomField
CRM_Core_BAO_UFField::setUFField($id, $is_active);
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_CustomField', $id, 'is_active', $is_active);
}
示例5: setUFFieldStatus
/**
* Function to enable/disable profile field given a custom group id
*
* @param int $customGroupId custom group id
* @param boolean $is_active value we want to set the is_active field
*
* @return void
* @static
* @access public
*/
function setUFFieldStatus($customGroupId, $is_active)
{
//find the profile id given custom group id
$dao =& new CRM_Core_DAO();
$queryString = "SELECT civicrm_custom_field.id as custom_field_id\n FROM civicrm_custom_field, civicrm_custom_group\n WHERE civicrm_custom_field.custom_group_id = civicrm_custom_group.id\n AND civicrm_custom_group.id =" . CRM_Utils_Type::escape($customGroupId, 'Integer');
$dao->query($queryString);
while ($dao->fetch()) {
//enable/ disable profile
CRM_Core_BAO_UFField::setUFField($dao->custom_field_id, $is_active);
}
}