Skip to content

Commit

Permalink
This is the first check-in of support for groups.
Browse files Browse the repository at this point in the history
It's very early (it doesn't actually do anything yet!) but you can
define groups and get an idea of how the interface is shaping up.
I also wanted to show that I have actually done something on this! :-)

From here my plan is to add group support to the modules, one by one
(forums first), then go back and clean up some of the central interfaces,
graphics etc.

Finally, test, test, test and get 1.2 out well before the end of February.
  • Loading branch information
moodler committed Dec 30, 2003
1 parent ee39bbe commit f374fb1
Show file tree
Hide file tree
Showing 22 changed files with 1,029 additions and 57 deletions.
6 changes: 3 additions & 3 deletions course/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
if (iscreator()) {
if (isset($_GET['edit'])) {
if ($edit == "on") {
$USER->editing = true;
$USER->categoryediting = true;
} else if ($edit == "off") {
$USER->editing = false;
$USER->categoryediting = false;
}
}
$navbaritem = update_category_button($category->id);

$creatorediting = !empty($USER->editing);
$creatorediting = !empty($USER->categoryediting);
$adminediting = (isadmin() and $creatorediting);

} else {
Expand Down
110 changes: 66 additions & 44 deletions course/edit.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<FORM METHOD="post" action="edit.php" NAME="form">
<table cellpadding=9 cellspacing=0 >
<tr valign=top>
<td><P><?php print_string("category") ?>:</td>
<td align="right"><P><?php print_string("category") ?>:</td>
<td><?php
$displaylist = array();
$parentlist = array();
Expand All @@ -12,28 +12,75 @@
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("fullname") ?>:</td>
<td align="right"><P><?php print_string("fullname") ?>:</td>
<td><input type="text" name="fullname" maxlength="254" size=50 value="<?php p($form->fullname) ?>">
<?php helpbutton("coursefullname", get_string("fullname")) ?>
<?php if (isset($err["fullname"])) formerr($err["fullname"]); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("shortname") ?>:</td>
<td align="right"><P><?php print_string("shortname") ?>:</td>
<td><input type="text" name="shortname" maxlength="15" size="10" value="<?php p($form->shortname) ?>">
<?php helpbutton("courseshortname", get_string("shortname")) ?>
<?php if (isset($err["shortname"])) formerr($err["shortname"]); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("summary") ?>:</td>
<td><TEXTAREA NAME=summary COLS=50 ROWS=10 WRAP=virtual><?php p($form->summary) ?></TEXTAREA>
<?php helpbutton("text", get_string("helptext")) ?>
<?php if (isset($err["summary"])) formerr($err["summary"]); ?>
<td align="right"><P><?php print_string("summary") ?>:</td>
<td><?php
print_textarea($usehtmleditor, 10, 50, 660, 200, "summary", $form->summary);
helpbutton("text", get_string("helptext"));
if (isset($err["summary"])) formerr($err["summary"]);
?>
</td>
</tr>
<tr valign=top>
<td align="right"><P><?php print_string("format") ?>:</td>
<td><?php
choose_from_menu ($form->courseformats, "format", "$form->format", "");
helpbutton("courseformats", get_string("courseformats"));
?>
</td>
</tr>
<tr valign=top>
<td align="right"><P><?php print_string("startdate") ?>:</td>
<td><?php
print_date_selector("startday", "startmonth", "startyear", $form->startdate);
helpbutton("coursestartdate", get_string("startdate"));
?></td>
</tr>
<tr valign=top>
<td align="right"><P><?php print_string("numberweeks") ?>:</td>
<td><?php
for ($i=1; $i<=52; $i++) {
$sectionmenu[$i] = "$i";
}
choose_from_menu ($sectionmenu, "numsections", "$form->numsections", "");
helpbutton("coursenumsections", get_string("numberweeks"));
?></td>
</tr>
<tr valign=top>
<td align="right"><P><?php print_string("groupmode") ?>:</td>
<td><?php
unset($choices);
$choices[NOGROUPS] = get_string("groupsnone");
$choices[SEPARATEGROUPS] = get_string("groupsseparate");
$choices[VISIBLEGROUPS] = get_string("groupsvisible");
choose_from_menu ($choices, "groupmode", $form->groupmode, "");
helpbutton("groupmode", get_string("groupmode"));

echo '&nbsp;&nbsp;&nbsp;&nbsp;';
print_string('force');
echo ': ';
unset($choices);
$choices["0"] = get_string("no");
$choices["1"] = get_string("yes");
choose_from_menu ($choices, "groupmodeforce", $form->groupmodeforce, "");
helpbutton("groupmodeforce", get_string("groupmodeforce")); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("availability") ?>:</td>
<td align="right"><P><?php print_string("availability") ?>:</td>
<td><?php
unset($choices);
$choices["0"] = get_string("courseavailablenot");
Expand All @@ -43,14 +90,14 @@
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("enrolmentkey") ?>:</td>
<td align="right"><P><?php print_string("enrolmentkey") ?>:</td>
<td><input type="text" name="password" size=25 value="<?php p($form->password) ?>">
<?php helpbutton("enrolmentkey", get_string("enrolmentkey")) ?>
<?php if (isset($err["password"])) formerr($err["password"]); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("opentoguests") ?>:</td>
<td align="right"><P><?php print_string("opentoguests") ?>:</td>
<td><?php
unset($choices);
$choices["0"] = get_string("guestsno");
Expand All @@ -61,15 +108,7 @@
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("format") ?>:</td>
<td><?php
choose_from_menu ($form->courseformats, "format", "$form->format", "");
helpbutton("courseformats", get_string("courseformats"));
?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("newsitemsnumber") ?>:</td>
<td align="right"><P><?php print_string("newsitemsnumber") ?>:</td>
<td><?php
$newsitem = get_string("newsitem");
$newsitems = get_string("newsitems");
Expand All @@ -91,24 +130,7 @@
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("startdate") ?>:</td>
<td><?php
print_date_selector("startday", "startmonth", "startyear", $form->startdate);
helpbutton("coursestartdate", get_string("startdate"));
?></td>
</tr>
<tr valign=top>
<td><P><?php print_string("numberweeks") ?>:</td>
<td><?php
for ($i=1; $i<=52; $i++) {
$sectionmenu[$i] = "$i";
}
choose_from_menu ($sectionmenu, "numsections", "$form->numsections", "");
helpbutton("coursenumsections", get_string("numberweeks"));
?></td>
</tr>
<tr valign=top>
<td><P><?php print_string("showrecent") ?>:</td>
<td align="right"><P><?php print_string("showrecent") ?>:</td>
<td><?php
unset($choices);
$choices["0"] = get_string("no");
Expand All @@ -118,7 +140,7 @@
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("showgrades") ?>:</td>
<td align="right"><P><?php print_string("showgrades") ?>:</td>
<td><?php
unset($choices);
$choices["0"] = get_string("no");
Expand All @@ -128,7 +150,7 @@
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("showreports") ?>:</td>
<td align="right"><P><?php print_string("showreports") ?>:</td>
<td><?php
unset($choices);
$choices["0"] = get_string("no");
Expand All @@ -138,36 +160,36 @@
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("maximumupload") ?>:</td>
<td align="right"><P><?php print_string("maximumupload") ?>:</td>
<td><?php
$choices = get_max_upload_sizes($CFG->maxbytes);
choose_from_menu ($choices, "maxbytes", $form->maxbytes, "");
helpbutton("courseuploadsize", get_string("maximumupload")); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("wordforteacher") ?>:</td>
<td align="right"><P><?php print_string("wordforteacher") ?>:</td>
<td><input type="text" name="teacher" maxlength="100" size=25 value="<?php p($form->teacher) ?>">
(<?php print_string("wordforteachereg") ?>)
<?php if (isset($err["teacher"])) formerr($err["teacher"]); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("wordforteachers") ?>:</td>
<td align="right"><P><?php print_string("wordforteachers") ?>:</td>
<td><input type="text" name="teachers" maxlength="100" size=25 value="<?php p($form->teachers) ?>">
(<?php print_string("wordforteacherseg") ?>)
<?php if (isset($err["teachers"])) formerr($err["teachers"]); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("wordforstudent") ?>:</td>
<td align="right"><P><?php print_string("wordforstudent") ?>:</td>
<td><input type="text" name="student" maxlength="100" size=25 value="<?php p($form->student) ?>">
(<?php print_string("wordforstudenteg") ?>)
<?php if (isset($err["student"])) formerr($err["student"]); ?>
</td>
</tr>
<tr valign=top>
<td><P><?php print_string("wordforstudents") ?>:</td>
<td align="right"><P><?php print_string("wordforstudents") ?>:</td>
<td><input type="text" name="students" maxlength="100" size=25 value="<?php p($form->students) ?>">
(<?php print_string("wordforstudentseg") ?>)
<?php if (isset($err["students"])) formerr($err["students"]); ?>
Expand Down
8 changes: 8 additions & 0 deletions course/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
$form->newsitems = 5;
$form->showrecent = 1;
$form->showgrades = 1;
$form->groupmode = 0;
$form->groupmodeforce = 0;
$form->category = $category;
$form->id = "";
$form->visible = 1;
Expand Down Expand Up @@ -147,6 +149,8 @@
$form->courseformats["$courseformat"] = get_string("format$courseformat");
}

$usehtmleditor = can_use_html_editor();

$streditcoursesettings = get_string("editcoursesettings");
$straddnewcourse = get_string("addnewcourse");
$stradministration = get_string("administration");
Expand All @@ -169,6 +173,10 @@

print_footer($course);

if ($usehtmleditor) {
use_html_editor();
}

exit;

/// Functions /////////////////////////////////////////////////////////////////
Expand Down
12 changes: 12 additions & 0 deletions course/format/social/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
require_once("$CFG->dirroot/mod/resource/lib.php");

$leftwidth = 210;
$strgroups = get_string("groups");
$strgroupmy = get_string("groupmy");
?>

<table width="100%" border="0" cellspacing="5" cellpadding="5">
Expand All @@ -14,6 +16,16 @@
<?php
$moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
$modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";

if ($course->groupmode or !$course->groupmodeforce) {
if (isteacheredit($course->id) or $course->groupmode == VISIBLEGROUPS) {
$moddata[]="<a title=\"$strgroups\" href=\"groups.php?id=$course->id\">$strgroups</a>";
} else if ($currentgroup = get_current_group($course->id)) {
$moddata[]="<a title=\"$strgroupmy\" href=\"group.php?id=$course->id\">$strgroupmy</a>";
}
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
}

$fullname = fullname($USER, true);
$editmyprofile = "<a title=\"$fullname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".
get_string("editmyprofile")."</A>";
Expand Down
12 changes: 12 additions & 0 deletions course/format/topics/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
$stractivities = get_string("activities");
$strshowalltopics = get_string("showalltopics");
$strtopic = get_string("topic");
$strgroups = get_string("groups");
$strgroupmy = get_string("groupmy");
if (isediting($course->id)) {
$strstudents = moodle_strtolower($course->students);
$strtopichide = get_string("topichide", "", $strstudents);
Expand All @@ -55,6 +57,16 @@
/// Links to people
$moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
$modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";

if ($course->groupmode or !$course->groupmodeforce) {
if (isteacheredit($course->id) or $course->groupmode == VISIBLEGROUPS) {
$moddata[]="<a title=\"$strgroups\" href=\"groups.php?id=$course->id\">$strgroups</a>";
} else if ($currentgroup = get_current_group($course->id)) {
$moddata[]="<a title=\"$strgroupmy\" href=\"group.php?id=$course->id\">$strgroupmy</a>";
}
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
}

$fullname = fullname($USER, true);
$editmyprofile = "<a title=\"$fullname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
if ($USER->description) {
Expand Down
12 changes: 12 additions & 0 deletions course/format/weeks/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
$stractivities = get_string("activities");
$strshowallweeks = get_string("showallweeks");
$strweek = get_string("week");
$strgroups = get_string("groups");
$strgroupmy = get_string("groupmy");
if (isediting($course->id)) {
$strstudents = moodle_strtolower($course->students);
$strweekhide = get_string("weekhide", "", $strstudents);
Expand All @@ -43,6 +45,16 @@
/// Links to people
$moddata[]="<a title=\"".get_string("listofallpeople")."\" href=\"../user/index.php?id=$course->id\">".get_string("participants")."</a>";
$modicon[]="<img src=\"$CFG->pixpath/i/users.gif\" height=16 width=16 alt=\"\">";

if ($course->groupmode or !$course->groupmodeforce) {
if (isteacheredit($course->id) or $course->groupmode == VISIBLEGROUPS) {
$moddata[]="<a title=\"$strgroups\" href=\"groups.php?id=$course->id\">$strgroups</a>";
} else if ($currentgroup = get_current_group($course->id)) {
$moddata[]="<a title=\"$strgroupmy\" href=\"group.php?id=$course->id\">$strgroupmy</a>";
}
$modicon[]="<img src=\"$CFG->pixpath/i/group.gif\" height=16 width=16 alt=\"\">";
}

$fullname = fullname($USER, true);
$editmyprofile = "<a title=\"$fullname\" href=\"../user/edit.php?id=$USER->id&course=$course->id\">".get_string("editmyprofile")."</a>";
if ($USER->description) {
Expand Down
Loading

0 comments on commit f374fb1

Please sign in to comment.