Example #1
0
    }
    $group_data = (object) array('id' => null, 'name' => null, 'description' => null, 'grouptype' => 'standard', 'open' => 1, 'controlled' => 0, 'category' => 0, 'public' => 0, 'usersautoadded' => 0, 'viewnotify' => GROUP_ROLES_ALL, 'submittableto' => 0, 'allowarchives' => 0, 'editroles' => 'all', 'hidden' => 0, 'hidemembers' => 0, 'hidemembersfrommembers' => 0, 'groupparticipationreports' => 0, 'invitefriends' => 0, 'suggestfriends' => 0, 'urlid' => null, 'editwindowstart' => null, 'editwindowend' => null, 'sendnow' => 0, 'feedbacknotify' => GROUP_ROLES_ALL);
}
$form = array('name' => 'editgroup', 'plugintype' => 'core', 'pluginname' => 'groups', 'elements' => array('name' => array('type' => 'text', 'title' => get_string('groupname', 'group'), 'rules' => array('required' => true, 'maxlength' => 128), 'defaultvalue' => $group_data->name), 'description' => array('type' => 'wysiwyg', 'title' => get_string('groupdescription', 'group'), 'rules' => array('maxlength' => 65536), 'rows' => 10, 'cols' => 55, 'defaultvalue' => $group_data->description), 'urlid' => array('type' => 'text', 'title' => get_string('groupurl', 'group'), 'prehtml' => '<span class="description">' . get_config('wwwroot') . get_config('cleanurlgroupdefault') . '/</span> ', 'description' => get_string('groupurldescription', 'group') . ' ' . get_string('cleanurlallowedcharacters'), 'rules' => array('maxlength' => 30, 'regex' => get_config('cleanurlvalidate')), 'defaultvalue' => $group_data->urlid, 'ignore' => !$id || !get_config('cleanurls')), 'settings' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => false, 'class' => 'sectioned last', 'legend' => get_string('settings'), 'elements' => array()), 'submit' => array('type' => 'submitcancel', 'class' => 'btn-primary', 'value' => array(get_string('savegroup', 'group'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'group/mygroups.php')));
$elements = array();
$elements['membership'] = array('type' => 'html', 'value' => '<h4>' . get_string('Membership', 'group') . '</h4>');
$cancreatecontrolled = $USER->get('admin') || $USER->get('staff') || $USER->is_institutional_admin() || $USER->is_institutional_staff();
$elements['open'] = array('type' => 'switchbox', 'title' => get_string('Open', 'group'), 'description' => get_string('opendescription', 'group'), 'defaultvalue' => $group_data->open, 'disabled' => !$cancreatecontrolled && $group_data->controlled);
if ($cancreatecontrolled || $group_data->controlled) {
    $elements['controlled'] = array('type' => 'switchbox', 'title' => get_string('Controlled', 'group'), 'description' => get_string('controlleddescription', 'group'), 'defaultvalue' => $group_data->controlled, 'disabled' => !$cancreatecontrolled);
} else {
    $form['elements']['controlled'] = array('type' => 'hidden', 'value' => $group_data->controlled);
}
$elements['request'] = array('type' => 'switchbox', 'title' => get_string('request', 'group'), 'description' => get_string('requestdescription', 'group'), 'defaultvalue' => !$group_data->open && $group_data->request, 'disabled' => $group_data->open);
// The grouptype determines the allowed roles
$grouptypeoptions = group_get_grouptype_options($group_data->grouptype);
// Hide the grouptype option if it was passed in as a parameter, if the user
// isn't allowed to change it, or if there's only one option.
if (!$id) {
    $grouptypeparam = param_alphanumext('grouptype', 0);
    if (isset($grouptypeoptions[$grouptypeparam])) {
        $group_data->grouptype = $grouptypeparam;
        $forcegrouptype = true;
    }
} else {
    if (!isset($grouptypeoptions[$group_data->grouptype])) {
        // The user can't create groups of this type.  Probably a non-staff user
        // who's been promoted to admin of a controlled group.
        $forcegrouptype = true;
    }
}
        $viewaccess->allowcomments = 0;
        $viewaccess->approvecomments = 1;
        $view->add_access($viewaccess);
    }
}
$allowcomments = $view->get('allowcomments');
$form['elements']['accesslist'] = array('type' => 'viewacl', 'allowcomments' => $allowcomments, 'defaultvalue' => $view->get_access(get_string('strftimedatetimeshort')), 'viewtype' => $view->get('type'));
$form['elements']['more'] = array('type' => 'fieldset', 'class' => $view->get('type') == 'profile' ? 'hidden' : '', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('moreoptions', 'view'), 'elements' => array('allowcomments' => array('type' => 'checkbox', 'title' => get_string('allowcomments', 'artefact.comment'), 'description' => get_string('allowcommentsonview', 'view'), 'defaultvalue' => $view->get('allowcomments')), 'approvecomments' => array('type' => 'checkbox', 'title' => get_string('moderatecomments', 'artefact.comment'), 'description' => get_string('moderatecommentsdescription', 'artefact.comment'), 'defaultvalue' => $view->get('approvecomments')), 'template' => array('type' => 'checkbox', 'title' => get_string('allowcopying', 'view'), 'description' => get_string('templatedescriptionplural1', 'view'), 'defaultvalue' => $view->get('template'))));
$js = '';
if ($institution) {
    if ($institution == 'mahara') {
        $form['elements']['more']['elements']['copynewuser'] = array('type' => 'checkbox', 'title' => get_string('copyfornewusers', 'view'), 'description' => get_string('copyfornewusersdescription1', 'view'), 'defaultvalue' => $view->get('copynewuser'));
        $form['elements']['more']['elements']['copyfornewgroups'] = array('type' => 'html', 'value' => '<strong>' . get_string('copyfornewgroups', 'view') . '</strong>');
        $form['elements']['more']['elements']['copyfornewgroupsdescription1'] = array('type' => 'html', 'value' => '<div class="description">' . get_string('copyfornewgroupsdescription1', 'view') . '</div>');
        $createfor = $view->get_autocreate_grouptypes();
        foreach (group_get_grouptype_options() as $grouptype => $grouptypedesc) {
            $form['elements']['more']['elements']['copyfornewgroups_' . $grouptype] = array('type' => 'checkbox', 'title' => $grouptypedesc, 'defaultvalue' => in_array($grouptype, $createfor));
        }
    } else {
        require_once 'institution.php';
        $i = new Institution($institution);
        $instname = hsc($i->displayname);
        $form['elements']['more']['elements']['copynewuser'] = array('type' => 'checkbox', 'title' => get_string('copyfornewmembers', 'view'), 'description' => get_string('copyfornewmembersdescription1', 'view', $instname), 'defaultvalue' => $view->get('copynewuser'));
    }
} else {
    $form['elements']['more']['elements']['retainview'] = array('type' => 'checkbox', 'title' => get_string('retainviewrights1', 'view'), 'description' => $group ? get_string('retainviewrightsgroupdescription1', 'view') : get_string('retainviewrightsdescription1', 'view'), 'defaultvalue' => $view->get('template') && $view->get('retainview'));
    $js .= <<<EOF
function update_retainview() {
    if (\$('editaccess_template').checked) {
        removeElementClass(\$('editaccess_retainview_container'), 'hidden');
    }
Example #3
0
 public static function get_instance_config_options($institution, $instance = 0)
 {
     global $CFG;
     // list of user_type
     $utopt = array();
     $utopt['edir'] = 'Novell Edirectory';
     $utopt['rfc2307'] = 'posixAccount (rfc2307)';
     $utopt['rfc2307bis'] = 'posixAccount (rfc2307bis)';
     $utopt['samba'] = 'sambaSamAccount (v.3.0.7)';
     $utopt['ad'] = 'MS ActiveDirectory';
     $utopt['default'] = 'default';
     $yesnoopt = array('yes' => 'Yes', 'no' => 'No');
     $versionopt = array('2' => '2', '3' => '3');
     if ($instance > 0) {
         $default = get_record('auth_instance', 'id', $instance);
         if ($default == false) {
             throw new SystemException('Could not find data for auth instance ' . $instance);
         }
         $current_config = get_records_menu('auth_instance_config', 'instance', $instance, '', 'field, value');
         if ($current_config == false) {
             $current_config = array();
         }
         foreach (self::$default_config as $key => $value) {
             if (array_key_exists($key, $current_config)) {
                 self::$default_config[$key] = $current_config[$key];
             }
         }
     } else {
         $default = new stdClass();
         $default->instancename = '';
     }
     require_once $CFG->docroot . 'lib/group.php';
     $grouptypeopt = group_get_grouptype_options(self::$default_config['syncgroupsgrouptype']);
     $elements = array('instancename' => array('type' => 'text', 'title' => get_string('authname', 'auth'), 'rules' => array('required' => true), 'defaultvalue' => $default->instancename), 'instance' => array('type' => 'hidden', 'value' => $instance), 'institution' => array('type' => 'hidden', 'value' => $institution), 'authname' => array('type' => 'hidden', 'value' => 'ldap'), 'host_url' => array('type' => 'text', 'title' => get_string('hosturl', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['host_url'], 'help' => true), 'contexts' => array('type' => 'text', 'title' => get_string('contexts', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['contexts'], 'help' => true), 'user_type' => array('type' => 'select', 'title' => get_string('usertype', 'auth.ldap'), 'options' => $utopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['user_type'], 'help' => true), 'user_attribute' => array('type' => 'text', 'title' => get_string('userattribute', 'auth.ldap'), 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['user_attribute'], 'help' => true), 'search_sub' => array('type' => 'select', 'title' => get_string('searchsubcontexts', 'auth.ldap'), 'options' => $yesnoopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['search_sub'], 'help' => true), 'bind_dn' => array('type' => 'text', 'title' => get_string('distinguishedname', 'auth.ldap'), 'defaultvalue' => self::$default_config['bind_dn'], 'help' => true), 'bind_pw' => array('type' => 'password', 'title' => get_string('password', 'auth.ldap'), 'defaultvalue' => self::$default_config['bind_pw'], 'help' => true), 'version' => array('type' => 'select', 'title' => get_string('ldapversion', 'auth.ldap'), 'options' => $versionopt, 'rules' => array('required' => true), 'defaultvalue' => self::$default_config['version'], 'help' => true), 'starttls' => array('type' => 'checkbox', 'title' => get_string('starttls', 'auth.ldap'), 'defaultvalue' => self::$default_config['starttls']), 'updateuserinfoonlogin' => array('type' => 'checkbox', 'title' => get_string('updateuserinfoonlogin', 'auth.ldap'), 'defaultvalue' => self::$default_config['updateuserinfoonlogin'], 'help' => true), 'weautocreateusers' => array('type' => 'checkbox', 'title' => get_string('weautocreateusers', 'auth.ldap'), 'defaultvalue' => self::$default_config['weautocreateusers'], 'help' => true), 'firstnamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforfirstname', 'auth.ldap'), 'defaultvalue' => self::$default_config['firstnamefield'], 'help' => true), 'surnamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforsurname', 'auth.ldap'), 'defaultvalue' => self::$default_config['surnamefield'], 'help' => true), 'emailfield' => array('type' => 'text', 'title' => get_string('ldapfieldforemail', 'auth.ldap'), 'defaultvalue' => self::$default_config['emailfield'], 'help' => true), 'studentidfield' => array('type' => 'text', 'title' => get_string('ldapfieldforstudentid', 'auth.ldap'), 'defaultvalue' => self::$default_config['studentidfield'], 'help' => true), 'preferrednamefield' => array('type' => 'text', 'title' => get_string('ldapfieldforpreferredname', 'auth.ldap'), 'defaultvalue' => self::$default_config['preferrednamefield'], 'help' => true), 'syncuserscronset' => array('type' => 'fieldset', 'legend' => get_string('syncuserssettings', 'auth.ldap'), 'collapsible' => true, 'collapsed' => !self::$default_config['syncuserscron'], 'elements' => array('syncuserscron' => array('type' => 'checkbox', 'title' => get_string('syncuserscron', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncuserscron']), 'syncusersupdate' => array('type' => 'checkbox', 'title' => get_string('syncusersupdate', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncusersupdate']), 'syncuserscreate' => array('type' => 'checkbox', 'title' => get_string('syncuserscreate', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncuserscreate']), 'syncusersextrafilterattribute' => array('type' => 'text', 'title' => get_string('syncusersextrafilterattribute', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncusersextrafilterattribute']), 'syncusersgonefromldap' => array('type' => 'select', 'title' => get_string('syncusersgonefromldap', 'auth.ldap'), 'help' => true, 'options' => array('' => get_string('syncusersgonefromldapdonothing', 'auth.ldap'), 'suspend' => get_string('syncusersgonefromldapsuspend', 'auth.ldap'), 'delete' => get_string('syncusersgonefromldapdelete', 'auth.ldap')), 'defaultvalue' => self::$default_config['syncusersgonefromldap']))), 'syncgroupscronset' => array('type' => 'fieldset', 'legend' => get_string('syncgroupssettings', 'auth.ldap'), 'collapsible' => true, 'collapsed' => !self::$default_config['syncgroupscron'], 'elements' => array('syncgroupscron' => array('type' => 'checkbox', 'title' => get_string('syncgroupscron', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupscron']), 'syncgroupsautocreate' => array('type' => 'checkbox', 'title' => get_string('syncgroupsautocreate', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsautocreate']), 'syncgroupsgrouptype' => array('type' => 'select', 'title' => get_string('syncgroupsgrouptype', 'auth.ldap'), 'options' => $grouptypeopt, 'defaultvalue' => self::$default_config['syncgroupsgrouptype']), 'syncgroupsexcludelist' => array('type' => 'text', 'title' => get_string('syncgroupsexcludelist', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsexcludelist']), 'syncgroupsincludelist' => array('type' => 'text', 'title' => get_string('syncgroupsincludelist', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsincludelist']), 'syncgroupshr1' => array('type' => 'html', 'value' => '<hr />'), 'syncgroupsbyclass' => array('type' => 'checkbox', 'title' => get_string('syncgroupsbyclass', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsbyclass']), 'syncgroupsgroupclass' => array('type' => 'text', 'title' => get_string('syncgroupsgroupclass', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsgroupclass']), 'syncgroupsgroupattribute' => array('type' => 'text', 'title' => get_string('syncgroupsgroupattribute', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsgroupattribute']), 'syncgroupsmemberattribute' => array('type' => 'text', 'title' => get_string('syncgroupsmemberattribute', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsmemberattribute']), 'syncgroupsmemberattributeisdn' => array('type' => 'checkbox', 'title' => get_string('syncgroupsmemberattributeisdn', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsmemberattributeisdn']), 'syncgroupsnestedgroups' => array('type' => 'checkbox', 'title' => get_string('syncgroupsnestedgroups', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsnestedgroups']), 'syncgroupscontexts' => array('type' => 'text', 'title' => get_string('syncgroupscontexts', 'auth.ldap'), 'description' => get_string('syncgroupscontextsdesc', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupscontexts']), 'syncgroupssearchsub' => array('type' => 'select', 'title' => get_string('searchsubcontexts', 'auth.ldap'), 'options' => $yesnoopt, 'defaultvalue' => self::$default_config['syncgroupssearchsub']), 'syncgroupshr2' => array('type' => 'html', 'value' => '<hr />'), 'syncgroupsbyuserfield' => array('type' => 'checkbox', 'title' => get_string('syncgroupsbyuserfield', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsbyuserfield']), 'syncgroupsuserattribute' => array('type' => 'text', 'title' => get_string('syncgroupsuserattribute', 'auth.ldap'), 'defaultvalue' => self::$default_config['syncgroupsuserattribute']), 'syncgroupsusergroupnames' => array('type' => 'text', 'title' => get_string('syncgroupsusergroupnames', 'auth.ldap'), 'description' => get_string('syncgroupsusergroupnamesdesc', 'auth.ldap'), 'help' => true, 'defaultvalue' => self::$default_config['syncgroupsusergroupnames']))));
     return array('elements' => $elements, 'renderer' => 'table');
 }
 * @copyright  (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
define('INTERNAL', 1);
define('MENUITEM', 'groups/groupsiown');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'group.php';
define('TITLE', get_string('creategroup', 'group'));
if (!group_can_create_groups()) {
    throw new AccessDeniedException(get_string('accessdenied', 'error'));
}
$elements = array();
$elements['name'] = array('type' => 'text', 'title' => get_string('groupname', 'group'), 'rules' => array('required' => true, 'maxlength' => 128));
$elements['description'] = array('type' => 'wysiwyg', 'title' => get_string('groupdescription', 'group'), 'rows' => 10, 'cols' => 55);
$elements['grouptype'] = array('type' => 'select', 'title' => get_string('grouptype', 'group'), 'options' => group_get_grouptype_options(), 'defaultvalue' => 'standard.open', 'help' => true);
if (get_config('allowgroupcategories') && ($groupcategories = get_records_menu('group_category', '', '', 'displayorder', 'id,title'))) {
    $elements['category'] = array('type' => 'select', 'title' => get_string('groupcategory', 'group'), 'options' => array('0' => get_string('nocategoryselected', 'group')) + $groupcategories, 'defaultvalue' => '');
}
$elements['public'] = array('type' => 'select', 'title' => get_string('publiclyviewablegroup', 'group'), 'description' => get_string('publiclyviewablegroupdescription', 'group'), 'options' => array(true => get_string('yes'), false => get_string('no')), 'defaultvalue' => 'no', 'help' => true, 'ignore' => !(get_config('createpublicgroups') == 'all' || get_config('createpublicgroups') == 'admins' && $USER->get('admin')));
$elements['usersautoadded'] = array('type' => 'select', 'title' => get_string('usersautoadded', 'group'), 'description' => get_string('usersautoaddeddescription', 'group'), 'options' => array(true => get_string('yes'), false => get_string('no')), 'defaultvalue' => 'no', 'help' => true, 'ignore' => !$USER->get('admin'));
$elements['viewnotify'] = array('type' => 'checkbox', 'title' => get_string('viewnotify', 'group'), 'description' => get_string('viewnotifydescription', 'group'), 'defaultvalue' => 1);
$elements['submit'] = array('type' => 'submitcancel', 'value' => array(get_string('savegroup', 'group'), get_string('cancel')));
$creategroup = pieform(array('name' => 'creategroup', 'method' => 'post', 'plugintype' => 'core', 'pluginname' => 'groups', 'elements' => $elements));
$smarty = smarty();
$smarty->assign('form', $creategroup);
$smarty->assign('PAGEHEADING', TITLE);
$smarty->display('form.tpl');
function creategroup_validate(Pieform $form, $values)
{
    if (get_field('group', 'id', 'name', $values['name'])) {
require_once get_config('libroot') . 'group.php';
require_once get_config('libroot') . 'institution.php';
safe_require('artefact', 'internal');
raise_memory_limit("512M");
// Turn on autodetecting of line endings, so mac newlines (\r) will work
ini_set('auto_detect_line_endings', 1);
$FORMAT = array();
$ALLOWEDKEYS = array('shortname', 'displayname', 'description', 'open', 'controlled', 'request', 'roles', 'public', 'submitpages', 'allowarchives', 'editroles', 'hidden', 'hidemembers', 'hidemembersfrommembers', 'invitefriends', 'suggestfriends');
if ($USER->get('admin')) {
    $ALLOWEDKEYS[] = 'usersautoadded';
    $ALLOWEDKEYS[] = 'quota';
}
$MANDATORYFIELDS = array('shortname', 'displayname', 'roles');
$UPDATES = array();
// During validation, remember which group already exist
$GROUPTYPES = group_get_grouptype_options();
$EDITROLES = group_get_editroles_options();
$form = array('name' => 'uploadcsv', 'elements' => array('institution' => get_institution_selector(), 'file' => array('type' => 'file', 'title' => get_string('csvfile', 'admin'), 'description' => get_string('groupcsvfiledescription', 'admin'), 'accept' => '.csv, text/csv, application/csv, text/comma-separated-values', 'rules' => array('required' => true)), 'updategroups' => array('type' => 'checkbox', 'title' => get_string('updategroups', 'admin'), 'description' => get_string('updategroupsdescription', 'admin'), 'defaultvalue' => false), 'submit' => array('type' => 'submit', 'value' => get_string('uploadgroupcsv', 'admin'))));
/**
 * The CSV file is parsed here so validation errors can be returned to the
 * user. The data from a successful parsing is stored in the <var>$CVSDATA</var>
 * array so it can be accessed by the submit function
 *
 * @param Pieform  $form   The form to validate
 * @param array    $values The values submitted
 */
function uploadcsv_validate(Pieform $form, $values)
{
    global $CSVDATA, $ALLOWEDKEYS, $MANDATORYFIELDS, $GROUPTYPES, $FORMAT, $USER, $UPDATES, $EDITROLES;
    // Don't even start attempting to parse if there are previous errors
    if ($form->has_errors()) {
Example #6
0
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    mahara
 * @subpackage core
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
define('INTERNAL', 1);
define('MENUITEM', 'groups/groupsiown');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'group.php';
define('TITLE', get_string('creategroup', 'group'));
$creategroup = pieform(array('name' => 'creategroup', 'method' => 'post', 'plugintype' => 'core', 'pluginname' => 'groups', 'elements' => array('name' => array('type' => 'text', 'title' => get_string('groupname', 'group'), 'rules' => array('required' => true, 'maxlength' => 128)), 'description' => array('type' => 'wysiwyg', 'title' => get_string('groupdescription', 'group'), 'rows' => 10, 'cols' => 55), 'grouptype' => array('type' => 'select', 'title' => get_string('grouptype', 'group'), 'options' => group_get_grouptype_options(), 'defaultvalue' => 'standard.open', 'help' => true), 'public' => array('type' => 'select', 'title' => get_string('publiclyviewablegroup', 'group'), 'description' => get_string('publiclyviewablegroupdescription', 'group'), 'options' => array(true => get_string('yes'), false => get_string('no')), 'defaultvalue' => 'no', 'help' => true, 'ignore' => !(get_config('createpublicgroups') == 'all' || get_config('createpublicgroups') == 'admins' && $USER->get('admin'))), 'usersautoadded' => array('type' => 'select', 'title' => get_string('usersautoadded', 'group'), 'description' => get_string('usersautoaddeddescription', 'group'), 'options' => array(true => get_string('yes'), false => get_string('no')), 'defaultvalue' => 'no', 'help' => true, 'ignore' => !$USER->get('admin')), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('savegroup', 'group'), get_string('cancel'))))));
$smarty = smarty();
$smarty->assign('creategroup', $creategroup);
$smarty->display('group/create.tpl');
function creategroup_validate(Pieform $form, $values)
{
    //global $USER;
    //global $SESSION;
    if (get_field('group', 'id', 'name', $values['name'])) {
        $form->set_error('name', get_string('groupalreadyexists', 'group'));
    }
}
function creategroup_cancel_submit()
{
    redirect('/group/mygroups.php');
}