/** * Searches for groups * * @since 1.3 * @access public * @param string * @return */ public function search($keyword, $options = array()) { $db = ES::db(); $sql = $db->sql(); $sql->select('#__social_clusters'); $sql->where('cluster_type', SOCIAL_TYPE_GROUP); $sql->where('title', '%' . $keyword . '%', 'LIKE'); // Determines if we should search for unpublished groups as well $unpublished = isset($options['unpublished']) && $options['unpublished'] ? true : false; if (!$unpublished) { $sql->where('state', SOCIAL_STATE_PUBLISHED); } // Determines if we should exclude specific group ids $exclusion = isset($options['exclusion']) && $options['exclusion'] ? $options['exclusion'] : false; if ($exclusion) { $exclusion = ES::makeArray($exclusion); $sql->where('id', $exclusion, 'NOT IN'); } $db->setQuery($sql); $result = $db->loadObjectList(); $groups = array(); if (!$result) { return $groups; } foreach ($result as $row) { $group = FD::group(); $group->bind($row); $groups[] = $group; } return $groups; }
/** * Allows caller to pass in an array of gid to be binded to the object property. * * @since 1.0 * @access public * @param Array An array of group id's. * @return boolean True on success false otherwise. */ public function bindUserGroups($gids = array()) { $gids = ES::makeArray($gids); if (is_array($gids) && !empty($gids)) { $this->gid = json_encode($gids); return true; } return false; }
/** * Displays the switch profile form * * @since 1.0 * @access public * @param string * @return */ public function switchProfileForm() { // Get the id's of the user that we are trying to modify $ids = $this->input->get('ids', array(), 'array'); $ids = ES::makeArray($ids); $theme = ES::themes(); $theme->set('ids', $ids); $output = $theme->output('admin/users/dialog.switch.profile'); return $this->ajax->resolve($output); }