本文整理汇总了PHP中CRM_Core_BAO_PrevNextCache::markSelection方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_PrevNextCache::markSelection方法的具体用法?PHP CRM_Core_BAO_PrevNextCache::markSelection怎么用?PHP CRM_Core_BAO_PrevNextCache::markSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_PrevNextCache
的用法示例。
在下文中一共展示了CRM_Core_BAO_PrevNextCache::markSelection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: selectUnselectContacts
static function selectUnselectContacts()
{
$name = CRM_Utils_Array::value('name', $_POST);
$cacheKey = CRM_Utils_Array::value('qfKey', $_POST);
$state = CRM_Utils_Array::value('state', $_POST, 'checked');
$variableType = CRM_Utils_Array::value('variableType', $_POST, 'single');
$actionToPerform = CRM_Utils_Array::value('action', $_POST, 'select');
if ($actionToPerform == 'countSelection') {
$contactIds = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey);
$countSelectionCids = count($contactIds[$cacheKey]);
$arrRet = array('getCount' => $countSelectionCids);
echo json_encode($arrRet);
CRM_Utils_System::civiExit();
} elseif ($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);
} else {
CRM_Core_BAO_PrevNextCache::markSelection($cacheKey, $actionToPerform);
}
} elseif ($variableType == 'single') {
$cId = self::_convertToId($name);
$action = $state == 'checked' ? 'select' : 'unselect';
CRM_Core_BAO_PrevNextCache::markSelection($cacheKey, $action, $cId);
}
}