本文整理汇总了PHP中CRM_Core_BAO_PrevNextCache::buildSelectedContactPager方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_PrevNextCache::buildSelectedContactPager方法的具体用法?PHP CRM_Core_BAO_PrevNextCache::buildSelectedContactPager怎么用?PHP CRM_Core_BAO_PrevNextCache::buildSelectedContactPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_PrevNextCache
的用法示例。
在下文中一共展示了CRM_Core_BAO_PrevNextCache::buildSelectedContactPager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
//when user come from search context.
$ssID = $this->get('ssID');
$this->assign('ssid', $ssID);
$this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) {
$params = array();
$value = CRM_Core_BAO_PrevNextCache::buildSelectedContactPager($this, $params);
$result = CRM_Core_BAO_PrevNextCache::getSelectedContacts($value['offset'], $value['rowCount1']);
$this->assign("value", $result);
}
}
示例2: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
if (CRM_Mailing_Info::workflowEnabled() && !CRM_Core_Permission::check('schedule mailings')) {
$url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'reset=1&scheduled=false');
CRM_Utils_System::redirect($url);
}
//when user come from search context.
$ssID = $this->get('ssID');
$this->assign('ssid', $ssID);
$this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) {
$params = array();
$value = CRM_Core_BAO_PrevNextCache::buildSelectedContactPager($this, $params);
$result = CRM_Core_BAO_PrevNextCache::getSelectedContacts($value['offset'], $value['rowCount1']);
$this->assign("value", $result);
}
$this->_mailingID = $this->get('mailing_id');
$this->_scheduleFormOnly = FALSE;
if (!$this->_mailingID) {
$this->_mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, TRUE);
$this->_scheduleFormOnly = TRUE;
}
}
示例3: preProcessCommon
//.........这里部分代码省略.........
$sortByCharacter = $form->get('sortByCharacter');
$cacheKey = $sortByCharacter && $sortByCharacter != 'all' ? "{$cacheKey}_alphabet" : $cacheKey;
if ($form->_action == CRM_Core_Action::COPY) {
$allCids[$cacheKey] = $form->getContactIds();
} else {
$allCids = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey, "getall");
}
$form->_contactIds = array();
if ($useTable) {
$count = 0;
$insertString = array();
foreach ($allCids[$cacheKey] as $cid => $ignore) {
$count++;
$insertString[] = " ( {$cid} ) ";
if ($count % 200 == 0) {
$string = implode(',', $insertString);
$sql = "REPLACE INTO {$form->_componentTable} ( contact_id ) VALUES {$string}";
CRM_Core_DAO::executeQuery($sql);
$insertString = array();
}
}
if (!empty($insertString)) {
$string = implode(',', $insertString);
$sql = "REPLACE INTO {$form->_componentTable} ( contact_id ) VALUES {$string}";
CRM_Core_DAO::executeQuery($sql);
}
} else {
// filter duplicates here
// CRM-7058
// might be better to do this in the query, but that logic is a bit complex
// and it decides when to use distinct based on input criteria, which needs
// to be fixed and optimized.
foreach ($allCids[$cacheKey] as $cid => $ignore) {
$form->_contactIds[] = $cid;
}
}
} elseif (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel') {
// selected contacts only
// need to perform action on only selected contacts
$insertString = array();
// refire sql in case of custom seach
if ($form->_action == CRM_Core_Action::COPY) {
// selected contacts only
// need to perform action on only selected contacts
foreach (self::$_searchFormValues as $name => $value) {
if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
$contactID = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
if ($useTable) {
$insertString[] = " ( {$contactID} ) ";
} else {
$form->_contactIds[] = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
}
}
}
} else {
// fetching selected contact ids of passed cache key
$selectedCids = CRM_Core_BAO_PrevNextCache::getSelection($cacheKey);
foreach ($selectedCids[$cacheKey] as $selectedCid => $ignore) {
if ($useTable) {
$insertString[] = " ( {$selectedCid} ) ";
} else {
$form->_contactIds[] = $selectedCid;
}
}
}
if (!empty($insertString)) {
$string = implode(',', $insertString);
$sql = "REPLACE INTO {$form->_componentTable} ( contact_id ) VALUES {$string}";
CRM_Core_DAO::executeQuery($sql);
}
}
//contact type for pick up profiles as per selected contact types with subtypes
//CRM-5521
if ($selectedTypes = CRM_Utils_Array::value('contact_type', self::$_searchFormValues)) {
if (!is_array($selectedTypes)) {
$selectedTypes = explode(' ', $selectedTypes);
}
foreach ($selectedTypes as $ct => $dontcare) {
if (strpos($ct, CRM_Core_DAO::VALUE_SEPARATOR) === FALSE) {
$form->_contactTypes[] = $ct;
} else {
$separator = strpos($ct, CRM_Core_DAO::VALUE_SEPARATOR);
$form->_contactTypes[] = substr($ct, $separator + 1);
}
}
}
if (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel' && $form->_action != CRM_Core_Action::COPY) {
$params = array();
$sel = CRM_Utils_Array::value('radio_ts', self::$_searchFormValues);
$form->assign('searchtype', $sel);
$value = CRM_Core_BAO_PrevNextCache::buildSelectedContactPager($form, $params);
$result = CRM_Core_BAO_PrevNextCache::getSelectedContacts($value['offset'], $value['rowCount1']);
$form->assign("value", $result);
}
if (!empty($form->_contactIds)) {
$form->_componentClause = ' contact_a.id IN ( ' . implode(',', $form->_contactIds) . ' ) ';
$form->assign('totalSelectedContacts', count($form->_contactIds));
$form->_componentIds = $form->_contactIds;
}
}