mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 01:37:02 +02:00
improved group handling
This commit is contained in:
@ -140,10 +140,12 @@ class ModelGroupGroup extends Model {
|
||||
}
|
||||
|
||||
|
||||
public function get_emails_by_string($s = '') {
|
||||
if(strlen($s) < 2) { return array(); }
|
||||
public function get_emails_by_string($s = '', $page = 0, $page_len = PAGE_LEN) {
|
||||
$from = (int)$page * (int)$page_len;
|
||||
|
||||
$query = $this->db->query("SELECT email FROM `" . TABLE_EMAIL . "` WHERE email LIKE ? ORDER BY email ASC", array($s . "%") );
|
||||
if(strlen($s) < 1) { return array(); }
|
||||
|
||||
$query = $this->db->query("SELECT email FROM `" . TABLE_EMAIL . "` WHERE email LIKE ? ORDER BY email ASC LIMIT " . (int)$from . ", " . (int)$page_len, array($s . "%") );
|
||||
|
||||
if(isset($query->rows)) { return $query->rows; }
|
||||
|
||||
@ -151,6 +153,15 @@ class ModelGroupGroup extends Model {
|
||||
}
|
||||
|
||||
|
||||
public function count_emails($s = '') {
|
||||
if(strlen($s) < 1) { return 0; }
|
||||
|
||||
$query = $this->db->query("SELECT COUNT(*) AS num FROM `" . TABLE_EMAIL . "` WHERE email LIKE ?", array($s . "%") );
|
||||
|
||||
return $query->row['num'];
|
||||
}
|
||||
|
||||
|
||||
public function get_groups_by_string($s = '') {
|
||||
if(strlen($s) < 2) { return array(); }
|
||||
|
||||
|
Reference in New Issue
Block a user