本文整理汇总了PHP中CRM_Core_DAO_CustomGroup::whereAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_CustomGroup::whereAdd方法的具体用法?PHP CRM_Core_DAO_CustomGroup::whereAdd怎么用?PHP CRM_Core_DAO_CustomGroup::whereAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_DAO_CustomGroup::whereAdd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IN
/**
* @param $entityType
* @param $path
* @param string $cidToken
*
* @return array
*/
public static function &getActiveGroups($entityType, $path, $cidToken = '%%cid%%')
{
// for Group's
$customGroupDAO = new CRM_Core_DAO_CustomGroup();
// get 'Tab' and 'Tab with table' groups
$customGroupDAO->whereAdd("style IN ('Tab', 'Tab with table')");
$customGroupDAO->whereAdd("is_active = 1");
// add whereAdd for entity type
self::_addWhereAdd($customGroupDAO, $entityType, $cidToken);
$groups = array();
$permissionClause = CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, NULL, TRUE);
$customGroupDAO->whereAdd($permissionClause);
// order by weight
$customGroupDAO->orderBy('weight');
$customGroupDAO->find();
// process each group with menu tab
while ($customGroupDAO->fetch()) {
$group = array();
$group['id'] = $customGroupDAO->id;
$group['path'] = $path;
$group['title'] = "{$customGroupDAO->title}";
$group['query'] = "reset=1&gid={$customGroupDAO->id}&cid={$cidToken}";
$group['extra'] = array('gid' => $customGroupDAO->id);
$group['table_name'] = $customGroupDAO->table_name;
$group['is_multiple'] = $customGroupDAO->is_multiple;
$groups[] = $group;
}
return $groups;
}
示例2: del
/**
* Delete Contact SubTypes.
*
* @param int $contactTypeId
* ID of the Contact Subtype to be deleted.
*
* @return bool
*/
public static function del($contactTypeId)
{
if (!$contactTypeId) {
return FALSE;
}
$params = array('id' => $contactTypeId);
self::retrieve($params, $typeInfo);
$name = $typeInfo['name'];
// check if any custom group
$custom = new CRM_Core_DAO_CustomGroup();
$custom->whereAdd("extends_entity_column_value LIKE '%" . CRM_Core_DAO::VALUE_SEPARATOR . $name . CRM_Core_DAO::VALUE_SEPARATOR . "%'");
if ($custom->find()) {
return FALSE;
}
// remove subtype for existing contacts
$sql = "\nUPDATE civicrm_contact SET contact_sub_type = NULL\nWHERE contact_sub_type = '{$name}'";
CRM_Core_DAO::executeQuery($sql);
// remove subtype from contact type table
$contactType = new CRM_Contact_DAO_ContactType();
$contactType->id = $contactTypeId;
$contactType->delete();
// remove navigation entry if any
if ($name) {
$sql = "\nDELETE\nFROM civicrm_navigation\nWHERE name = %1";
$params = array(1 => array("New {$name}", 'String'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
CRM_Core_BAO_Navigation::resetNavigation();
}
return TRUE;
}