Lots of work on site display, over many files. Improved front page
and display of site modules.
This commit is contained in:
+8
-7
@@ -162,16 +162,17 @@
|
||||
|
||||
// At this point, the databases exist, and the user is an admin
|
||||
|
||||
print_header("$site->fullname: Administration Page","$site->fullname: Administration Page", "Admin");
|
||||
$stradministration = get_string("administration");
|
||||
print_header("$site->fullname: $stradministration","$site->fullname: $stradministration", "$stradministration");
|
||||
|
||||
$table->head = array ("Site Management", "Course Setup", "Other");
|
||||
$table->align = array ("CENTER", "CENTER", "CENTER");
|
||||
$table->data[0][0] = "<P><A HREF=\"site.php\">Site settings</A></P>".
|
||||
"<P><A HREF=\"../course/log.php?id=$site->id\">Site logs</A></P>";
|
||||
$table->data[0][1] = "<P><A HREF=\"../course/edit.php\">Create a new course</A></P>".
|
||||
"<P><A HREF=\"../course/teacher.php\">Assign teachers to a course</A></P>".
|
||||
"<P><A HREF=\"../course/delete.php\">Delete a course</A></P>";
|
||||
$table->data[0][2] = "<P><A HREF=\"user.php\">Edit a user's account</A></P>";
|
||||
$table->data[0][0] = "<P><A HREF=\"site.php\">".get_string("sitesettings")."</A></P>".
|
||||
"<P><A HREF=\"../course/log.php?id=$site->id\">".get_string("sitelogs")."</A></P>";
|
||||
$table->data[0][1] = "<P><A HREF=\"../course/edit.php\">".get_string("addnewcourse")."</A></P>".
|
||||
"<P><A HREF=\"../course/teacher.php\">".get_string("assignteachers")."</A></P>".
|
||||
"<P><A HREF=\"../course/delete.php\">".get_string("deletecourse")."</A></P>";
|
||||
$table->data[0][2] = "<P><A HREF=\"user.php\">".get_string("edituser")."</A></P>";
|
||||
|
||||
print_table($table);
|
||||
|
||||
|
||||
@@ -44,4 +44,5 @@
|
||||
</TABLE>
|
||||
<INPUT type="hidden" name="id" value="<?=$form->id ?>">
|
||||
<INPUT type="hidden" name="category" value="<?=$form->category ?>">
|
||||
<INPUT type="hidden" name="format" value="<?=$form->format ?>">
|
||||
</FORM>
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@
|
||||
require("../config.php");
|
||||
|
||||
$course = get_site();
|
||||
$course->format = "social"; // override
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
@@ -49,7 +50,7 @@
|
||||
$form = $course;
|
||||
} else {
|
||||
$form->category = 0;
|
||||
$form->newsitems = 1;
|
||||
$form->format = "social";
|
||||
}
|
||||
|
||||
print_header("Admin: Setting up site", "Administration: Setting up site",
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@
|
||||
$section->id = insert_record("course_sections", $section);
|
||||
|
||||
add_to_log($newid, "course", "new", "view.php?id=$newid", "");
|
||||
redirect("$CFG->wwwroot/admin/teacher.php?id=$newid", get_string("changessaved"));
|
||||
redirect("teacher.php?id=$newid", get_string("changessaved"));
|
||||
} else {
|
||||
error("Serious Error! Could not create the new course!");
|
||||
}
|
||||
|
||||
+64
-14
@@ -174,12 +174,28 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
|
||||
}
|
||||
|
||||
|
||||
function print_all_courses($cat=1) {
|
||||
function print_all_courses($cat=1, $style="full", $maxcount=999) {
|
||||
global $CFG;
|
||||
|
||||
if ($courses = get_records("course", "category", $cat, "fullname ASC")) {
|
||||
foreach ($courses as $course) {
|
||||
print_course($course);
|
||||
echo "<BR>\n";
|
||||
if ($style == "minimal") {
|
||||
$count = 0;
|
||||
$icon = "<IMG SRC=\"pix/i/course.gif\" HEIGHT=16 WIDTH=16 ALT=\"Course\">";
|
||||
foreach ($courses as $course) {
|
||||
$moddata[]="<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</A>";
|
||||
$modicon[]=$icon;
|
||||
if ($count++ >= $maxcount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$fulllist = "<P><A HREF=\"$CFG->wwwroot/course/\">".get_string("fulllistofcourses")."</A>...";
|
||||
print_side_block("", $moddata, "$fulllist", $modicon);
|
||||
|
||||
} else {
|
||||
foreach ($courses as $course) {
|
||||
print_course($course);
|
||||
echo "<BR>\n";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -398,6 +414,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
|
||||
|
||||
$mods = NULL; // course modules indexed by id
|
||||
$modnames = NULL; // all course module names
|
||||
$modnamesplural= NULL; // all course module names (plural form)
|
||||
$modnamesused = NULL; // course module names used
|
||||
|
||||
if ($allmods = get_records_sql("SELECT * FROM modules") ) {
|
||||
@@ -414,7 +431,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
|
||||
FROM modules m, course_modules cm
|
||||
WHERE cm.course = '$courseid'
|
||||
AND cm.deleted = '0'
|
||||
AND cm.module = m.id") ) {
|
||||
AND cm.module = m.id ") ) {
|
||||
foreach($rawmods as $mod) { // Index the mods
|
||||
$mods[$mod->id] = $mod;
|
||||
$mods[$mod->id]->modfullname = $modnames[$mod->modname];
|
||||
@@ -432,6 +449,31 @@ function get_all_sections($courseid) {
|
||||
ORDER BY section");
|
||||
}
|
||||
|
||||
function print_section($courseid, $section, $mods, $modnamesused, $absolute=false) {
|
||||
global $CFG;
|
||||
|
||||
|
||||
echo "<P>";
|
||||
if ($section->sequence) {
|
||||
|
||||
$sectionmods = explode(",", $section->sequence);
|
||||
|
||||
foreach ($sectionmods as $modnumber) {
|
||||
$mod = $mods[$modnumber];
|
||||
$instancename = get_field("$mod->modname", "name", "id", "$mod->instance");
|
||||
echo "<IMG SRC=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
|
||||
echo " <A TITLE=\"$mod->modfullname\"";
|
||||
echo " HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</A>";
|
||||
if (isediting($courseid)) {
|
||||
echo make_editing_buttons($mod->id, $absolute);
|
||||
}
|
||||
echo "<BR>\n";
|
||||
}
|
||||
}
|
||||
echo "</P>\n";
|
||||
}
|
||||
|
||||
|
||||
function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
|
||||
global $CFG;
|
||||
echo "<IMG BORDER=0 SRC=\"$CFG->wwwroot/course/loggraph.php?id=$course->id&user=$userid&type=$type&date=$date\">";
|
||||
@@ -654,20 +696,28 @@ function move_module($id, $move) {
|
||||
}
|
||||
}
|
||||
|
||||
function make_editing_buttons($moduleid) {
|
||||
function make_editing_buttons($moduleid, $absolute=false) {
|
||||
global $CFG;
|
||||
|
||||
$delete = get_string("delete");
|
||||
$moveup = get_string("moveup");
|
||||
$movedown = get_string("movedown");
|
||||
$update = get_string("update");
|
||||
|
||||
if ($absolute) {
|
||||
$path = "$CFG->wwwroot/course/";
|
||||
} else {
|
||||
$path = "";
|
||||
}
|
||||
return "
|
||||
<A HREF=mod.php?delete=$moduleid><IMG
|
||||
SRC=../pix/t/delete.gif BORDER=0 ALT=\"$delete\"></A>
|
||||
<A HREF=mod.php?id=$moduleid&move=-1><IMG
|
||||
SRC=../pix/t/up.gif BORDER=0 ALT=\"$moveup\"></A>
|
||||
<A HREF=mod.php?id=$moduleid&move=1><IMG
|
||||
SRC=../pix/t/down.gif BORDER=0 ALT=\"$movedown\"></A>
|
||||
<A HREF=mod.php?update=$moduleid><IMG
|
||||
SRC=../pix/t/edit.gif BORDER=0 ALT=\"$update\"></A>";
|
||||
<A HREF=\"".$path."mod.php?delete=$moduleid\"><IMG
|
||||
SRC=".$path."../pix/t/delete.gif BORDER=0 ALT=\"$delete\"></A>
|
||||
<A HREF=\"".$path."mod.php?id=$moduleid&move=-1\"><IMG
|
||||
SRC=".$path."../pix/t/up.gif BORDER=0 ALT=\"$moveup\"></A>
|
||||
<A HREF=\"".$path."mod.php?id=$moduleid&move=1\"><IMG
|
||||
SRC=".$path."../pix/t/down.gif BORDER=0 ALT=\"$movedown\"></A>
|
||||
<A HREF=\"".$path."mod.php?update=$moduleid\"><IMG
|
||||
SRC=".$path."../pix/t/edit.gif BORDER=0 ALT=\"$update\"></A>";
|
||||
}
|
||||
|
||||
function print_side_block($heading="", $list=NULL, $footer="", $icons=NULL) {
|
||||
|
||||
+1
-18
@@ -151,24 +151,7 @@
|
||||
|
||||
echo text_to_html($thissection->summary);
|
||||
|
||||
echo "<P>";
|
||||
if ($thissection->sequence) {
|
||||
|
||||
$thissectionmods = explode(",", $thissection->sequence);
|
||||
|
||||
foreach ($thissectionmods as $modnumber) {
|
||||
$mod = $mods[$modnumber];
|
||||
$instancename = get_field("$mod->modname", "name", "id", "$mod->instance");
|
||||
echo "<IMG SRC=\"../mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
|
||||
echo " <A TITLE=\"$mod->modfullname\"";
|
||||
echo " HREF=\"../mod/$mod->modname/view.php?id=$mod->id\">$instancename</A>";
|
||||
if (isediting($course->id)) {
|
||||
echo make_editing_buttons($mod->id);
|
||||
}
|
||||
echo "<BR>\n";
|
||||
}
|
||||
}
|
||||
echo "</UL></P>\n";
|
||||
print_section($course->id, $thissection, $mods, $modnamesused);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
echo "<DIV ALIGN=right>";
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@
|
||||
echo "</TR></TABLE>";
|
||||
|
||||
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts);
|
||||
|
||||
switch ($mode) {
|
||||
case "today" :
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@
|
||||
print_header("$courseword: $course->fullname", "$course->fullname", "$course->shortname", "search.search", "", true,
|
||||
update_course_icon($course->id));
|
||||
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts);
|
||||
|
||||
switch ($course->format) {
|
||||
case "weeks":
|
||||
|
||||
+3
-20
@@ -4,11 +4,11 @@
|
||||
|
||||
include("../mod/forum/lib.php");
|
||||
|
||||
if (! $sections = get_all_sections($course->id, $course->numsections) ) {
|
||||
if (! $sections = get_all_sections($course->id)) {
|
||||
$section->course = $course->id; // Create a default section.
|
||||
$section->section = 0;
|
||||
$section->id = insert_record("course_sections", $section);
|
||||
if (! $sections = get_all_sections($course->id, $course->numsections) ) {
|
||||
if (! $sections = get_all_sections($course->id) ) {
|
||||
error("Error finding or creating section structures for this course");
|
||||
}
|
||||
}
|
||||
@@ -141,24 +141,7 @@
|
||||
|
||||
echo text_to_html($thisweek->summary);
|
||||
|
||||
echo "<P>";
|
||||
if ($thisweek->sequence) {
|
||||
|
||||
$thisweekmods = explode(",", $thisweek->sequence);
|
||||
|
||||
foreach ($thisweekmods as $modnumber) {
|
||||
$mod = $mods[$modnumber];
|
||||
$instancename = get_field("$mod->modname", "name", "id", "$mod->instance");
|
||||
echo "<IMG SRC=\"../mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
|
||||
echo " <A TITLE=\"$mod->modfullname\"";
|
||||
echo " HREF=\"../mod/$mod->modname/view.php?id=$mod->id\">$instancename</A>";
|
||||
if (isediting($course->id)) {
|
||||
echo make_editing_buttons($mod->id);
|
||||
}
|
||||
echo "<BR>\n";
|
||||
}
|
||||
}
|
||||
echo "</UL></P>\n";
|
||||
print_section($course->id, $thisweek, $mods, $modnamesused);
|
||||
|
||||
if (isediting($course->id)) {
|
||||
echo "<DIV ALIGN=right>";
|
||||
|
||||
@@ -26,39 +26,51 @@
|
||||
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
|
||||
<TR>
|
||||
<TD VALIGN="TOP" NOWRAP>
|
||||
<? $readings = reading_list_all_readings();
|
||||
|
||||
if ($site->newsitems > 0 or $readings or isediting($site->id)) {
|
||||
|
||||
print_simple_box(get_string("mainmenu"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
|
||||
<?
|
||||
|
||||
$sections = get_all_sections($site->id);
|
||||
|
||||
if ($site->newsitems > 0 or $sections[0]->sequence or isediting($site->id)) {
|
||||
|
||||
if ($site->newsitems > 0 ) {
|
||||
echo "<LI><A TITLE=\"".
|
||||
get_string("availablecourses").
|
||||
"\" HREF=\"course/\"><B>".
|
||||
get_string("courses").
|
||||
"</B></A><BR></LI>";
|
||||
print_simple_box(get_string("courses"), "CENTER", "100%", "$THEME->cellheading");
|
||||
|
||||
print_all_courses($cat=1, "minimal", 10);
|
||||
}
|
||||
|
||||
if ($readings) {
|
||||
foreach ($readings as $reading) {
|
||||
echo "<LI>$reading";
|
||||
}
|
||||
if ($sections[0]->sequence or isediting($site->id)) {
|
||||
get_all_mods($site->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
print_simple_box(get_string("mainmenu"), "CENTER", "100%", "$THEME->cellheading");
|
||||
}
|
||||
|
||||
if ($sections[0]->sequence) {
|
||||
print_section($site->id, $sections[0], $mods, $modnamesused, true);
|
||||
}
|
||||
|
||||
if (isediting($site->id)) {
|
||||
echo "<P align=right><A HREF=\"$CFG->wwwroot/course/mod.php?id=$site->id§ion=0&add=reading\">".
|
||||
get_string("addreading", "reading")."</A>...</P>";
|
||||
} else {
|
||||
echo "<BR><BR>";
|
||||
echo "<DIV ALIGN=right>";
|
||||
popup_form("$CFG->wwwroot/course/mod.php?id=$site->id§ion=0&add=",
|
||||
$modnames, "section0", "", "Add...");
|
||||
echo "</DIV>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isadmin()) {
|
||||
print_simple_box(get_string("admin"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
|
||||
echo "<LI><A HREF=\"$CFG->wwwroot/admin/\">".get_string("adminpage")."...</A></LI>";
|
||||
echo "<LI><A HREF=\"$CFG->wwwroot/course/log.php?id=$site->id\">".get_string("sitelogs")."...</A></LI>";
|
||||
echo "<LI><A HREF=\"$CFG->wwwroot/admin/site.php\">".get_string("sitesettings")."...</A></LI>";
|
||||
print_simple_box(get_string("administration"), $align="CENTER", $width="100%", $color="$THEME->cellheading");
|
||||
$icon = "<IMG SRC=\"pix/i/settings.gif\" HEIGHT=16 WIDTH=16 ALT=\"\">";
|
||||
$moddata[]="<A HREF=\"course/log.php?id=$site->id\">".get_string("sitelogs")."</A>";
|
||||
$modicon[]=$icon;
|
||||
$moddata[]="<A HREF=\"admin/site.php\">".get_string("sitesettings")."</A>";
|
||||
$modicon[]=$icon;
|
||||
$moddata[]="<A HREF=\"course/edit.php\">".get_string("addnewcourse")."</A>";
|
||||
$modicon[]=$icon;
|
||||
$moddata[]="<A HREF=\"course/teacher.php\">".get_string("assignteachers")."</A>";
|
||||
$modicon[]=$icon;
|
||||
$moddata[]="<A HREF=\"course/delete.php\">".get_string("deletecourse")."</A>";
|
||||
$modicon[]=$icon;
|
||||
$moddata[]="<A HREF=\"admin/user.php\">".get_string("edituser")."</A>";
|
||||
$modicon[]=$icon;
|
||||
print_side_block("", $moddata, "", $modicon);
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ $string[forums] = "Forums";
|
||||
$string[generalforum] = "Standard forum for general use";
|
||||
$string[generalforums] = "General forums";
|
||||
$string[inforum] = "in \$a";
|
||||
$string[intronews] = "General news and announcements about this course";
|
||||
$string[intronews] = "General news and announcements";
|
||||
$string[introsocial] = "An open forum for chatting about anything you want to";
|
||||
$string[introteacher] = "A forum for teacher-only notes and discussion";
|
||||
$string[learningforums] = "Learning forums";
|
||||
|
||||
+6
-7
@@ -1,21 +1,17 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
#------------------------------------------------------------
|
||||
$string[modulename] = "Site";
|
||||
$string[modulenameplural] = "Sites";
|
||||
#------------------------------------------------------------
|
||||
|
||||
|
||||
$string[activity] = "Activity";
|
||||
$string[activityreport] = "Activity report";
|
||||
$string[addnewcourse] = "Add a new course";
|
||||
$string[address] = "Address";
|
||||
$string[admin] = "Admin";
|
||||
$string[adminpage] = "Admin page";
|
||||
$string[administration] = "Administration";
|
||||
$string[again] = "again";
|
||||
$string[alllogs] = "All logs";
|
||||
$string[allfieldsrequired] = "All fields are required";
|
||||
$string[alphanumerical] = "Can only contain alphabetical letters or numbers";
|
||||
$string[alreadyconfirmed] = "Registration has already been confirmed";
|
||||
$string[assignteachers] = "Assign teachers";
|
||||
$string[availablecourses] = "Available Courses";
|
||||
$string[category] = "Category";
|
||||
$string[changepassword] = "Change password";
|
||||
@@ -31,8 +27,10 @@ $string[createaccount] = "Create my new account";
|
||||
$string[createuserandpass] = "Create a new username and password to log in with";
|
||||
$string[currentlocaltime] = "your current local time";
|
||||
$string[delete] = "Delete";
|
||||
$string[deletecourse] = "Delete a course";
|
||||
$string[editcoursesettings] = "Edit course settings";
|
||||
$string[editmyprofile] = "Edit my profile";
|
||||
$string[edituser] = "Edit user accounts";
|
||||
$string[email] = "Email address";
|
||||
$string[emailformat] = "Email format";
|
||||
$string[emailconfirm] = "Confirm your account";
|
||||
@@ -68,6 +66,7 @@ $string[firstname] = "First name";
|
||||
$string[firsttime] = "Is this your first time here?";
|
||||
$string[forgotten] = "Forgotten your username or password?";
|
||||
$string[format] = "Format";
|
||||
$string[fulllistofcourses] = "Full list of courses";
|
||||
$string[fullprofile] = "Full profile";
|
||||
$string[fullname] = "Full name";
|
||||
$string[guestsno] = "No, do not allow guests in";
|
||||
|
||||
@@ -12,8 +12,12 @@
|
||||
|
||||
add_to_log($course->id, "choice", "view all", "index?id=$course->id", "");
|
||||
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
}
|
||||
|
||||
print_header("$course->shortname: Choices", "$course->fullname",
|
||||
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> Choices", "");
|
||||
"$navigation Choices", "");
|
||||
|
||||
|
||||
if (! $choices = get_all_instances_in_course("choice", $course->id, "cw.section ASC")) {
|
||||
|
||||
+4
-2
@@ -46,9 +46,11 @@
|
||||
|
||||
add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", "$choice->id");
|
||||
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
}
|
||||
print_header("$course->shortname: $choice->name", "$course->fullname",
|
||||
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
|
||||
<A HREF=index.php?id=$course->id>Choices</A> -> $choice->name", "", "", true,
|
||||
"$navigation <A HREF=index.php?id=$course->id>Choices</A> -> $choice->name", "", "", true,
|
||||
update_module_icon($cm->id, $course->id));
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
optional_variable($mode); // If set, changes the layout of the thread
|
||||
|
||||
if (! $discussion = get_record("forum_discussions", "id", $d)) {
|
||||
error("Discussion ID was incorrect");
|
||||
error("Discussion ID was incorrect or no longer exists");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $discussion->course)) {
|
||||
|
||||
+38
-27
@@ -58,6 +58,11 @@
|
||||
$generalforums[] = $forum;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!$course->category) {
|
||||
$generalforums[] = $forum;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,38 +96,44 @@
|
||||
unset($table->data);
|
||||
}
|
||||
|
||||
// Add extra field for section number, at the front
|
||||
array_unshift($table->head, "");
|
||||
array_unshift($table->align, "CENTER");
|
||||
|
||||
if ($learningforums = get_all_instances_in_course("forum", $course->id)) {
|
||||
foreach ($learningforums as $forum) {
|
||||
$count = count_records("forum_discussions", "forum", "$forum->id");
|
||||
|
||||
$forum->intro = forum_shorten_post($forum->intro);
|
||||
|
||||
if ($can_subscribe) {
|
||||
if (forum_is_forcesubscribed($forum->id)) {
|
||||
$sublink = get_string("yes");
|
||||
} else {
|
||||
if (forum_is_subscribed($USER->id, $forum->id)) {
|
||||
$subscribed = get_string("yes");
|
||||
$subtitle = get_string("unsubscribe", "forum");
|
||||
if ($course->category) { // Only real courses have learning forums
|
||||
// Add extra field for section number, at the front
|
||||
array_unshift($table->head, "");
|
||||
array_unshift($table->align, "CENTER");
|
||||
|
||||
if ($learningforums = get_all_instances_in_course("forum", $course->id)) {
|
||||
foreach ($learningforums as $forum) {
|
||||
$count = count_records("forum_discussions", "forum", "$forum->id");
|
||||
|
||||
$forum->intro = forum_shorten_post($forum->intro);
|
||||
|
||||
if (!$forum->section) { // some forums are in the "0" section
|
||||
$forum->section = "";
|
||||
}
|
||||
|
||||
if ($can_subscribe) {
|
||||
if (forum_is_forcesubscribed($forum->id)) {
|
||||
$sublink = get_string("yes");
|
||||
} else {
|
||||
$subscribed = get_string("no");
|
||||
$subtitle = get_string("subscribe", "forum");
|
||||
if (forum_is_subscribed($USER->id, $forum->id)) {
|
||||
$subscribed = get_string("yes");
|
||||
$subtitle = get_string("unsubscribe", "forum");
|
||||
} else {
|
||||
$subscribed = get_string("no");
|
||||
$subtitle = get_string("subscribe", "forum");
|
||||
}
|
||||
$sublink = "<A TITLE=\"$subtitle\" HREF=\"subscribe.php?id=$forum->id\">$subscribed</A>";
|
||||
}
|
||||
$sublink = "<A TITLE=\"$subtitle\" HREF=\"subscribe.php?id=$forum->id\">$subscribed</A>";
|
||||
$table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>",
|
||||
"$forum->intro", "$count", "$sublink");
|
||||
} else {
|
||||
$table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>",
|
||||
"$forum->intro", "$count");
|
||||
}
|
||||
$table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>",
|
||||
"$forum->intro", "$count", "$sublink");
|
||||
} else {
|
||||
$table->data[] = array ("$forum->section", "<A HREF=\"view.php?f=$forum->id\">$forum->name</A>",
|
||||
"$forum->intro", "$count");
|
||||
}
|
||||
print_heading(get_string("learningforums", "forum"));
|
||||
print_table($table);
|
||||
}
|
||||
print_heading(get_string("learningforums", "forum"));
|
||||
print_table($table);
|
||||
}
|
||||
|
||||
echo "<DIV ALIGN=CENTER>";
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
error("Course id is incorrect.");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
if ($course->category) {
|
||||
require_login($course->id);
|
||||
}
|
||||
|
||||
add_to_log($course->id, "forum", "search", "search.php?id=$course->id&search=$search", "$search");
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
|
||||
} else if ($f) {
|
||||
if (! $forum = get_record("forum", "id", $f)) {
|
||||
error("Forum ID was incorrect");
|
||||
error("Forum ID was incorrect or no longer exists");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $forum->course)) {
|
||||
error("Forum is misconfigured - don't know what course it's from");
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
require_login($course->id);
|
||||
add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
print_header("$course->shortname: Journals", "$course->fullname",
|
||||
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> Journals", "");
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
}
|
||||
|
||||
print_header("$course->shortname: Journals", "$course->fullname", "$navigation Journals", "");
|
||||
|
||||
|
||||
if (! $journals = get_all_instances_in_course("journal", $course->id, "cw.section ASC")) {
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
}
|
||||
print_header("$course->shortname: $journal->name", "$course->fullname",
|
||||
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
|
||||
<A HREF=index.php?id=$course->id>Journals</A> -> $journal->name", "", "", true,
|
||||
"$navigation <A HREF=index.php?id=$course->id>Journals</A> -> $journal->name", "", "", true,
|
||||
update_module_icon($cm->id, $course->id));
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
|
||||
add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
print_header("$course->shortname: Surveys", "$course->fullname",
|
||||
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> -> Surveys", "");
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
}
|
||||
print_header("$course->shortname: Surveys", "$course->fullname", "$navigation Surveys", "");
|
||||
|
||||
|
||||
if (! $surveys = get_all_instances_in_course("survey", $course->id, "cw.section ASC")) {
|
||||
|
||||
+5
-3
@@ -18,10 +18,12 @@
|
||||
if (! $survey = get_record("survey", "id", $cm->instance)) {
|
||||
error("Survey ID was incorrect");
|
||||
}
|
||||
|
||||
|
||||
if ($course->category) {
|
||||
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
|
||||
}
|
||||
print_header("$course->shortname: $survey->name", "$course->fullname",
|
||||
"<A HREF=../../course/view.php?id=$course->id>$course->shortname</A> ->
|
||||
<A HREF=index.php?id=$course->id>Surveys</A> -> $survey->name", "", "", true,
|
||||
"$navigation <A HREF=index.php?id=$course->id>Surveys</A> -> $survey->name", "", "", true,
|
||||
update_module_icon($cm->id, $course->id));
|
||||
|
||||
if (isteacher($course->id)) {
|
||||
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 109 B |
Reference in New Issue
Block a user