MDL-30478 - wiki - Fixing up group problems when viewing and creating wiki pages.

Thanks to Matt Kolb for his contribution.
This commit is contained in:
Adrian Greeve 2012-04-19 11:54:50 +08:00
parent ead4f180a0
commit 5dedd64d58
4 changed files with 69 additions and 19 deletions

View file

@ -64,6 +64,21 @@ class mod_wiki_create_form extends moodleform {
$mform->setType('pageformat', PARAM_ALPHANUMEXT);
$mform->addRule('pageformat', get_string('required'), 'required', null, 'client');
if (!empty($this->_customdata['groups']->availablegroups)) {
foreach ($this->_customdata['groups']->availablegroups as $groupdata) {
$groupinfo[$groupdata->id] = $groupdata->name;
}
if (count($groupinfo) > 1) {
$mform->addElement('select', 'groupinfo', get_string('group'), $groupinfo);
$mform->setDefault('groupinfo', $this->_customdata['groups']->currentgroup);
} else {
$groupid = key($groupinfo);
$groupname = $groupinfo[$groupid];
$mform->addElement('static', 'groupdesciption', get_string('group'), $groupname);
$mform->addElement('hidden', 'groupinfo', $groupid);
}
}
//hiddens
$mform->addElement('hidden', 'action', 'create');
$mform->setType('action', PARAM_ALPHA);