private function getGroupSelect(GWF_User $user) { $groups = GDO::table('GWF_Group')->selectAll('group_id, group_name'); $data = array(); $data[] = array('0', $this->module->lang('sel_group')); foreach ($groups as $group) { if (!$user->isInGroupID($group['group_id'])) { $data[] = array($group['group_id'], $group['group_name']); } } return GWF_Select::display('groups', $data, intval(Common::getPost('groups'))); }
public function validate_groups($m, $arg) { if ($arg === false) { return false; } if (!is_array($arg)) { return $m->lang('err_groups'); } foreach ($arg as $gid) { if (!$this->user->isInGroupID($gid)) { return $m->lang('err_groups'); } } return false; }
/** * Check if we have permission to view that link. In case we do, return empty string. else return verbose permission text. * @param Module_Links $module * @param GWF_User $user * @return string */ public function getPermissionText(Module_Links $module, $user) { static $text = NULL; if ($text === NULL) { $text = array($module->lang('permtext_in_mod'), $module->lang('permtext_score', array('%1%')), $module->lang('permtext_member'), $module->lang('permtext_group', array('%1%'))); } if ($this->isInModeration()) { return $text[0]; } $score = $user === false ? 0 : $user->getLevel(); # Check score $need_score = $this->getVar('link_score'); if ($score < $need_score) { return str_replace('%1%', $need_score, $text[1]); } # Check memberlink if ($user === false && $this->isMemberLink()) { return $text[2]; } # Check group $need_gid = $this->getGroupID(); if ($need_gid > 0) { if ($user === false || !$user->isInGroupID($need_gid)) { return str_replace('%1%', GWF_Group::getByID($need_gid)->displayName(), $text[3]); } } return ''; }