/** * Get querybuilder for JSON group member list */ public function get_qb($field = null, $direction = 'ASC') { $qb = midcom_db_person::new_collector('metadata.deleted', false); $member_ids = array_keys($this->_request_data['group']->get_members()); if (count($member_ids)) { $qb->add_constraint('id', 'IN', $member_ids); } else { $qb->add_constraint('id', '=', 0); } if (!is_null($field)) { if ($field == 'username') { midcom_core_account::add_username_order($qb, $direction); } else { $qb->add_order($field, $direction); } } $qb->add_order('lastname'); $qb->add_order('firstname'); $qb->add_order('email'); $qb->add_order('id'); return $qb; }
/** * Get querybuilder for JSON user list */ public function get_qb($field = null, $direction = 'ASC') { $qb = midcom_db_person::new_collector('metadata.deleted', false); //@todo constraint username <> '' ? if ($this->_group) { $mc = midcom_db_member::new_collector('gid', $this->_group->id); $members = $mc->get_values('uid'); if (empty($members)) { $qb->add_constraint('id', '=', 0); } else { $qb->add_constraint('id', 'IN', $members); } } if (!is_null($field)) { if ($field == 'username') { midcom_core_account::add_username_order($qb, $direction); } else { $qb->add_order($field, $direction); } } $qb->add_order('lastname'); $qb->add_order('firstname'); $qb->add_order('id'); return $qb; }