mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
added search capabilities to admin sections
This commit is contained in:
@ -2,10 +2,14 @@
|
||||
|
||||
class ModelDomainDomain extends Model {
|
||||
|
||||
public function getDomains() {
|
||||
public function getDomains($s = '') {
|
||||
$data = array();
|
||||
|
||||
$query = $this->db->query("SELECT domain, mapped, ldap_id FROM " . TABLE_DOMAIN . " ORDER BY domain ASC");
|
||||
if($s) {
|
||||
$query = $this->db->query("SELECT domain, mapped, ldap_id FROM " . TABLE_DOMAIN . " WHERE domain LIKE ? ORDER BY domain ASC", array('%' . $s . '%'));
|
||||
} else {
|
||||
$query = $this->db->query("SELECT domain, mapped, ldap_id FROM " . TABLE_DOMAIN . " ORDER BY domain ASC");
|
||||
}
|
||||
|
||||
if(isset($query->rows)) {
|
||||
foreach($query->rows as $q) {
|
||||
|
@ -3,8 +3,12 @@
|
||||
|
||||
class ModelPolicyArchiving extends Model {
|
||||
|
||||
public function get_rules() {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_ARCHIVING_RULE . " ORDER BY id");
|
||||
public function get_rules($s = '') {
|
||||
if($s) {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_ARCHIVING_RULE . " WHERE `from` LIKE ? OR `to` LIKE ? OR subject LIKE ? ORDER BY domain, id", array('%' . $s . '%', '%' . $s . '%', '%' . $s . '%'));
|
||||
} else {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_ARCHIVING_RULE . " ORDER BY id");
|
||||
}
|
||||
|
||||
if(isset($query->rows)) { return $query->rows; }
|
||||
|
||||
|
@ -3,8 +3,12 @@
|
||||
|
||||
class ModelPolicyRetention extends Model {
|
||||
|
||||
public function get_rules() {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_RETENTION_RULE . " ORDER BY domain, id");
|
||||
public function get_rules($s = '') {
|
||||
if($s) {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_RETENTION_RULE . " WHERE domain LIKE ? OR `from` LIKE ? OR subject LIKE ? ORDER BY domain, id", array('%' . $s . '%', '%' . $s . '%', '%' . $s . '%'));
|
||||
} else {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_RETENTION_RULE . " ORDER BY domain, id");
|
||||
}
|
||||
|
||||
if(isset($query->rows)) { return $query->rows; }
|
||||
|
||||
|
@ -10,7 +10,16 @@ class ModelSaasCustomer extends Model
|
||||
if($query->num_rows > 0) { return $query->row; }
|
||||
}
|
||||
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_CUSTOMER_SETTINGS . " ORDER BY domain ASC");
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
public function search($s = '') {
|
||||
if($s) {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_CUSTOMER_SETTINGS . " WHERE domain LIKE ? ORDER BY domain ASC", array('%' . $s . '%'));
|
||||
} else {
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_CUSTOMER_SETTINGS . " ORDER BY domain ASC");
|
||||
}
|
||||
|
||||
if($query->num_rows > 0) { return $query->rows; }
|
||||
|
||||
|
@ -5,12 +5,21 @@ class ModelSaasLdap extends Model
|
||||
|
||||
public function get($id = -1) {
|
||||
|
||||
if($id >= 0) {
|
||||
if(is_numeric($id) && $id >= 0) {
|
||||
$query = $this->db->query("SELECT id, description, ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_bind_pw, ldap_auditor_member_dn FROM " . TABLE_LDAP . " WHERE id=?", array($id));
|
||||
if($query->num_rows > 0) { return $query->row; }
|
||||
}
|
||||
|
||||
$query = $this->db->query("SELECT id, description, ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_auditor_member_dn FROM " . TABLE_LDAP . " ORDER BY description ASC");
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
public function search($s = '') {
|
||||
if($s) {
|
||||
$query = $this->db->query("SELECT id, description, ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_auditor_member_dn FROM " . TABLE_LDAP . " WHERE description LIKE ? ORDER BY description ASC", array('%' . $s . '%'));
|
||||
} else {
|
||||
$query = $this->db->query("SELECT id, description, ldap_type, ldap_host, ldap_base_dn, ldap_bind_dn, ldap_auditor_member_dn FROM " . TABLE_LDAP . " ORDER BY description ASC");
|
||||
}
|
||||
|
||||
if($query->num_rows > 0) { return $query->rows; }
|
||||
|
||||
|
Reference in New Issue
Block a user