From 9b541466d29aa867407b60024b79dc2d1e2101b5 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Fri, 2 Oct 2026 08:54:53 +0200 Subject: [PATCH] Add where grouping to StudentListLib --- application/libraries/stv/StudentListLib.php | 41 +++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/application/libraries/stv/StudentListLib.php b/application/libraries/stv/StudentListLib.php index 918848958..2db8bfde3 100644 --- a/application/libraries/stv/StudentListLib.php +++ b/application/libraries/stv/StudentListLib.php @@ -254,6 +254,39 @@ class StudentListLib return $this; } + /** + * Starts a WHERE GROUP + * + * @return StudentListLib + */ + public function groupStart() + { + $this->_wheres[] = 'group_start'; + return $this; + } + + /** + * Starts a OR WHERE GROUP + * + * @return StudentListLib + */ + public function orGroupStart() + { + $this->_wheres[] = 'or_group_start'; + return $this; + } + + /** + * Ends a OR WHERE GROUP + * + * @return StudentListLib + */ + public function groupEnd() + { + $this->_wheres[] = 'group_end'; + return $this; + } + /** * Generates the query and executes it. * @@ -297,7 +330,13 @@ class StudentListLib $this->_ci->PrestudentModel->addSelect($select[0], $select[1]); foreach ($this->_wheres as $where) { - if (!is_array($where[0]) && is_array($where[1])) { + if ($where == 'group_start') { + $this->_ci->PrestudentModel->db->group_start(); + } elseif ($where == 'or_group_start') { + $this->_ci->PrestudentModel->db->or_group_start(); + } elseif ($where == 'group_end') { + $this->_ci->PrestudentModel->db->group_end(); + } elseif (!is_array($where[0]) && is_array($where[1])) { if ($where[3]) $this->_ci->PrestudentModel->db->or_where_in($where[0], $where[1], $where[2]); else