|
|
@@ -181,6 +181,22 @@ class BxDolAccountQuery extends BxDolDb implements iBxDolSingleton {
|
|
|
$sSql = $this->prepare("DELETE FROM `sys_accounts` WHERE `id` = ? LIMIT 1", $iID);
|
|
|
return $this->query($sSql);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Search account profile by keyword
|
|
|
+ */
|
|
|
+ public function searchByTerm($sTerm, $iLimit)
|
|
|
+ {
|
|
|
+ $aFieldsQuickSearch = array('name', 'email');
|
|
|
+ $sWhere = '';
|
|
|
+ foreach ($aFieldsQuickSearch as $sField)
|
|
|
+ $sWhere .= $this->prepare(" OR `c`.`$sField` LIKE ? ", '%' . $sTerm . '%');
|
|
|
+
|
|
|
+ $sOrderBy = $this->prepare(" ORDER BY `added` DESC LIMIT ?", (int)$iLimit);
|
|
|
+
|
|
|
+ $sQuery = $this->prepare("SELECT `c`.`id` AS `content_id`, `p`.`account_id`, `p`.`id` AS `profile_id`, `p`.`status` AS `profile_status` FROM `sys_accounts` AS `c` INNER JOIN `sys_profiles` AS `p` ON (`p`.`content_id` = `c`.`id` AND `p`.`type` = ?) WHERE `p`.`status` = ?", 'system', BX_PROFILE_STATUS_ACTIVE);
|
|
|
+ return $this->getAll($sQuery . " AND (0 $sWhere) " . $sOrderBy);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/** @} */
|