mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
This is the first check-in of support for groups.
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.
This commit is contained in:
parent
ee39bbe0ee
commit
f374fb1006
22 changed files with 1029 additions and 57 deletions
|
@ -1069,7 +1069,7 @@ function print_file_picture($path, $courseid=0, $height="", $width="", $link="")
|
|||
}
|
||||
|
||||
function print_user_picture($userid, $courseid, $picture, $large=false, $returnstring=false, $link=true) {
|
||||
global $CFG, $THEME;
|
||||
global $CFG;
|
||||
|
||||
if ($link) {
|
||||
$output = "<a href=\"$CFG->wwwroot/user/view.php?id=$userid&course=$courseid\">";
|
||||
|
@ -1106,6 +1106,44 @@ function print_user_picture($userid, $courseid, $picture, $large=false, $returns
|
|||
}
|
||||
}
|
||||
|
||||
function print_group_picture($groupid, $courseid, $picture, $large=false, $returnstring=false, $link=true) {
|
||||
global $CFG;
|
||||
|
||||
if ($link) {
|
||||
$output = "<a href=\"$CFG->wwwroot/course/group.php?id=$courseid&group=$groupid\">";
|
||||
} else {
|
||||
$output = "";
|
||||
}
|
||||
if ($large) {
|
||||
$file = "f1";
|
||||
$size = 100;
|
||||
} else {
|
||||
$file = "f2";
|
||||
$size = 35;
|
||||
}
|
||||
if ($picture) { // Print custom group picture
|
||||
if ($CFG->slasharguments) { // Use this method if possible for better caching
|
||||
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pixgroup.php/$groupid/$file.jpg\"".
|
||||
" border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
|
||||
} else {
|
||||
$output .= "<img align=\"absmiddle\" src=\"$CFG->wwwroot/user/pixgroup.php?file=/$groupid/$file.jpg\"".
|
||||
" border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
|
||||
}
|
||||
} else { // Print default group pictures (use theme version if available)
|
||||
$output .= "<img align=\"absmiddle\" src=\"$CFG->pixpath/g/$file.png\"".
|
||||
" border=\"0\" width=\"$size\" height=\"$size\" alt=\"\" />";
|
||||
}
|
||||
if ($link) {
|
||||
$output .= "</a>";
|
||||
}
|
||||
|
||||
if ($returnstring) {
|
||||
return $output;
|
||||
} else {
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
function print_table($table) {
|
||||
// Prints a nicely formatted table.
|
||||
// $table is an object with several properties.
|
||||
|
@ -1404,7 +1442,7 @@ function update_category_button($categoryid) {
|
|||
global $CFG, $USER;
|
||||
|
||||
if (iscreator()) {
|
||||
if (!empty($USER->editing)) {
|
||||
if (!empty($USER->categoryediting)) {
|
||||
$string = get_string("turneditingoff");
|
||||
$edit = "off";
|
||||
} else {
|
||||
|
@ -1423,7 +1461,7 @@ function update_categories_button() {
|
|||
global $CFG, $USER;
|
||||
|
||||
if (isadmin()) {
|
||||
if (!empty($USER->editing)) {
|
||||
if (!empty($USER->categoriesediting)) {
|
||||
$string = get_string("turneditingoff");
|
||||
$edit = "off";
|
||||
} else {
|
||||
|
@ -1436,6 +1474,44 @@ function update_categories_button() {
|
|||
}
|
||||
}
|
||||
|
||||
function update_group_button($courseid) {
|
||||
// Prints the editing button on group page
|
||||
global $CFG, $USER;
|
||||
|
||||
if (isteacheredit($courseid)) {
|
||||
if (!empty($USER->groupediting)) {
|
||||
$string = get_string("turneditingoff");
|
||||
$edit = "off";
|
||||
} else {
|
||||
$string = get_string("turneditingon");
|
||||
$edit = "on";
|
||||
}
|
||||
return "<form target=\"$CFG->framename\" method=\"get\" action=\"$CFG->wwwroot/course/group.php\">".
|
||||
"<input type=\"hidden\" name=\"id\" value=\"$courseid\" />".
|
||||
"<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
|
||||
"<input type=\"submit\" value=\"$string\" /></form>";
|
||||
}
|
||||
}
|
||||
|
||||
function update_groups_button($courseid) {
|
||||
// Prints the editing button on groups page
|
||||
global $CFG, $USER;
|
||||
|
||||
if (isteacheredit($courseid)) {
|
||||
if (!empty($USER->groupsediting)) {
|
||||
$string = get_string("turneditingoff");
|
||||
$edit = "off";
|
||||
} else {
|
||||
$string = get_string("turneditingon");
|
||||
$edit = "on";
|
||||
}
|
||||
return "<form target=\"$CFG->framename\" method=\"get\" action=\"$CFG->wwwroot/course/groups.php\">".
|
||||
"<input type=\"hidden\" name=\"id\" value=\"$courseid\" />".
|
||||
"<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
|
||||
"<input type=\"submit\" value=\"$string\" /></form>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function navmenu($course, $cm=NULL, $targetwindow="self") {
|
||||
// Given a course and a (current) coursemodule
|
||||
|
@ -1801,6 +1877,10 @@ function print_paging_bar($totalcount, $page, $perpage, $baseurl) {
|
|||
if ($totalcount > $perpage) {
|
||||
echo "<center>";
|
||||
echo "<p>".get_string("page").":";
|
||||
if ($page > 0) {
|
||||
$pagenum=$page-1;
|
||||
echo " (<a href=\"{$baseurl}page=$pagenum\">".get_string("previous")."</a>) ";
|
||||
}
|
||||
$lastpage = ceil($totalcount / $perpage);
|
||||
if ($page > 15) {
|
||||
$startpage = $page - 10;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue