本文整理汇总了PHP中CRM_Core_BAO_CustomGroup::setIsActive方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomGroup::setIsActive方法的具体用法?PHP CRM_Core_BAO_CustomGroup::setIsActive怎么用?PHP CRM_Core_BAO_CustomGroup::setIsActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomGroup::setIsActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetIsActive
/**
* Function to test setIsActive()
*/
function testSetIsActive()
{
$customGrouptitle = 'My Custom Group';
$groupParams = array('title' => $customGrouptitle, 'name' => 'my_custom_group', 'style' => 'Tab', 'extends' => 'Individual', 'is_active' => 0);
$customGroup = Custom::createGroup($groupParams);
$customGroupId = $customGroup->id;
require_once 'CRM/Core/BAO/CustomGroup.php';
//update is_active
$result = CRM_Core_BAO_CustomGroup::setIsActive($customGroupId, true);
//check for object update
$this->assertEquals(true, $result);
//check for is_active
$this->assertDBCompareValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'is_active', 'id', true, 'Database check for custom group is_active field.');
//cleanup DB by deleting customGroup
Custom::deleteGroup($customGroup);
}
示例2: testSetIsActive
/**
* Test setIsActive()
*/
public function testSetIsActive()
{
$customGroupTitle = 'My Custom Group';
$groupParams = array('title' => $customGroupTitle, 'name' => 'my_custom_group', 'style' => 'Tab', 'extends' => 'Individual', 'is_active' => 0);
$customGroup = $this->customGroupCreate($groupParams);
$customGroupId = $customGroup['id'];
//update is_active
$result = CRM_Core_BAO_CustomGroup::setIsActive($customGroupId, TRUE);
//check for object update
$this->assertEquals(TRUE, $result);
//check for is_active
$this->assertDBCompareValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'is_active', 'id', 1, 'Database check for custom group is_active field.');
$this->customGroupDelete($customGroup['id']);
}
示例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.
* Finally it calls the parent's run method.
*
* @param null
*
* @return void
* @access public
*
*/
function run()
{
// get the requested action
$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/', 'action=browse'));
$controller =& new CRM_Core_Controller_Simple('CRM_Custom_Form_DeleteGroup', "Delete Cutom Group", $mode);
$id = CRM_Utils_Request::retrieve('id', $this, false, 0);
$controller->set('id', $id);
$controller->setEmbedded(true);
$controller->process();
$controller->run();
}
// 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($id, $action);
} else {
if ($action & CRM_CORE_ACTION_PREVIEW) {
$this->preview($id);
} else {
require_once 'CRM/Core/BAO/CustomGroup.php';
require_once 'CRM/Core/BAO/UFField.php';
// if action is enable or disable to the needful.
if ($action & CRM_CORE_ACTION_DISABLE) {
CRM_Core_BAO_CustomGroup::setIsActive($id, 0);
CRM_Core_BAO_UFField::setUFFieldStatus($id, 0);
} else {
if ($action & CRM_CORE_ACTION_ENABLE) {
CRM_Core_BAO_CustomGroup::setIsActive($id, 1);
//CRM_Core_BAO_UFField::setUFFieldStatus($id, 1);
}
}
// finally browse the custom groups
$this->browse();
}
}
// parent run
parent::run();
}