本文整理汇总了PHP中api_Utils::IsPhoneSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP api_Utils::IsPhoneSearch方法的具体用法?PHP api_Utils::IsPhoneSearch怎么用?PHP api_Utils::IsPhoneSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api_Utils
的用法示例。
在下文中一共展示了api_Utils::IsPhoneSearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetContactItemsCount
/**
* @param int $iUserId
* @param string $sSearch
* @param int $iGroupId
* @param int $iSharedTenantId = null
* @param bool $bAll = false
* @return string
*/
public function GetContactItemsCount($iUserId, $sSearch, $sFirstCharacter, $iGroupId, $iSharedTenantId = null, $bAll = false)
{
$sGroupAdd = '';
if (0 < $iGroupId) {
$sGroupAdd = sprintf('
INNER JOIN %sawm_addr_groups_contacts AS gr_cnt ON gr_cnt.id_addr = book.id_addr AND gr_cnt.id_group = %d', $this->prefix(), $iGroupId);
}
$sSearchAdd = '';
$sFirstCharacter = 0 < strlen(trim($sFirstCharacter)) ? trim($sFirstCharacter) : '';
if (!empty($sFirstCharacter)) {
$sSearch = '\'' . $this->escapeString($sFirstCharacter, true, true) . '%\'';
$sSearchAdd = sprintf('book.fullname LIKE %s OR book.firstname LIKE %s OR book.surname LIKE %s OR book.nickname LIKE %s OR book.h_email LIKE %s OR book.b_email LIKE %s OR book.other_email LIKE %s', $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch);
}
if (0 < strlen($sSearch)) {
$bPhone = api_Utils::IsPhoneSearch($sSearch);
$sPhoneSearch = $bPhone ? api_Utils::ClearPhoneSearch($sSearch) : '';
$sSearch = '\'%' . $this->escapeString($sSearch, true, true) . '%\'';
$sMainSearch = sprintf('book.fullname LIKE %s OR book.firstname LIKE %s OR book.surname LIKE %s OR book.nickname LIKE %s OR book.h_email LIKE %s OR book.b_email LIKE %s OR book.other_email LIKE %s', $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch, $sSearch);
if (0 < strlen($sPhoneSearch)) {
$sPhoneSearch = '\'%' . $this->escapeString($sPhoneSearch, true, true) . '%\'';
$sMainSearch .= sprintf(' OR ' . '(b_phone <> \'\' AND REPLACE(REPLACE(REPLACE(REPLACE(b_phone, \'(\', \'\'), \')\', \'\'), \'+\', \'\'), \' \', \'\') LIKE %s) OR ' . '(h_phone <> \'\' AND REPLACE(REPLACE(REPLACE(REPLACE(h_phone, \'(\', \'\'), \')\', \'\'), \'+\', \'\'), \' \', \'\') LIKE %s) OR ' . '(h_mobile <> \'\' AND REPLACE(REPLACE(REPLACE(REPLACE(h_mobile, \'(\', \'\'), \')\', \'\'), \'+\', \'\'), \' \', \'\') LIKE %s)', $sPhoneSearch, $sPhoneSearch, $sPhoneSearch);
}
$sSearchAdd = 0 === strlen($sSearchAdd) ? $sMainSearch : '(' . $sSearchAdd . ') AND (' . $sMainSearch . ')';
}
$sUserWhere = $this->sharedItemsSqlHelper($iUserId, $iGroupId, is_int($iSharedTenantId), 0 < $iGroupId, 'book.', $bAll);
$sSql = 'SELECT COUNT(book.id_addr) AS cnt FROM %sawm_addr_book as book%s
WHERE %s AND book.deleted = 0 AND book.hide_in_gab = 0 AND book.auto_create = 0%s';
return sprintf($sSql, $this->prefix(), $sGroupAdd, $sUserWhere, 0 < strlen($sSearchAdd) ? ' AND (' . $sSearchAdd . ')' : '');
}