function getMscMembers($msc_id, $post, $type = 'array') { $db = oseDB::instance(); $status = $post['status']; $where = array(); $start = $post['start']; $limit = $post['limit']; if (!empty($post['search'])) { $search = $post['search']; $searchEscaped = $db->Quote('%' . $db->getEscaped($search, true) . '%', false); $where[] = " mem.username LIKE {$searchEscaped} " . " OR mem.name LIKE {$searchEscaped} " . " OR mem.email LIKE {$searchEscaped} "; } $where[] = ' mem.msc_id = ' . $db->Quote($msc_id); if ($status == 1 || $status == 0) { $where[] = ' mem.status = ' . $db->Quote($status); } // Generate the where query $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : ''; $result = array(); $result['results'] = oseMemGroup::getMscMembers($msc_id, $where, $start, $limit); $result['total'] = oseMemGroup::getGroupTotal($msc_id, $where); return $result; }
function getMembers($msc_id, $status, $search = null, $start = 0, $limit = 20, $type = 'array') { $db = oseDB::instance(); $where = array(); if (!empty($search)) { $searchEscaped = strtolower($db->Quote('%' . $search . '%', false)); $searchEscaped = str_replace(" ", "%", $searchEscaped); $where[] = " LOWER(mem.username) LIKE {$searchEscaped} " . " OR LOWER(mem.name) LIKE {$searchEscaped} " . " OR LOWER(mem.email) LIKE {$searchEscaped} "; } if (is_array($msc_id)) { $msc_id = "('" . implode("','", $msc_id) . "')"; $where[] = ' mem.msc_id IN ' . $msc_id; //$db->Quote($msc_id); } else { $where[] = ' mem.msc_id = ' . $db->Quote($msc_id); } //$where[] = ' luv.group_name = '. $db->Quote('master'); if ($status == 1 || $status == 0) { $where[] = ' mem.status = ' . $db->Quote($status); } //$where = array_merge($where,oseJSON::generateQueryWhere()); // Generate the where query $where = count($where) ? ' WHERE (' . implode(') AND (', $where) . ')' : ''; $result = array(); $result['results'] = oseMemGroup::getMscMembers($msc_id, $where, $start, $limit); //oseExit($db->getQuery()); $result['total'] = oseMemGroup::getGroupTotal($msc_id, $where); return $result; }