More admin cleanups - improved user listing
[moodle.git] / course / lib.php
CommitLineData
f9903ed0 1<? // $Id$
2
ef58b822 3$COURSE_FORMATS = array (
b5fe4c93 4 "weeks" => "Weekly layout",
5 "social" => "Social layout",
6 "topics" => "Topics layout"
f9903ed0 7 );
8
ef58b822 9$COURSE_SECTION = array (
b5fe4c93 10 "weeks" => "week",
11 "social" => "section",
12 "topics" => "topic"
d9d1c35d 13 );
14
ef58b822 15$COURSE_MAX_LOG_DISPLAY = 150; // days
16
f9903ed0 17
f9903ed0 18function print_log_selector_form($course, $selecteduser=0, $selecteddate="today") {
19
9481285b 20 global $USER, $CFG;
21
f9903ed0 22 // Get all the possible users
23 $users = array();
720a43ce 24
25 if ($course->category) {
26 if ($students = get_records_sql("SELECT u.* FROM user u, user_students s
27 WHERE s.course = '$course->id' AND s.user = u.id
28 ORDER BY u.lastaccess DESC")) {
29 foreach ($students as $student) {
30 $users["$student->id"] = "$student->firstname $student->lastname";
31 }
32 }
33 if ($teachers = get_records_sql("SELECT u.* FROM user u, user_teachers t
34 WHERE t.course = '$course->id' AND t.user = u.id
35 ORDER BY u.lastaccess DESC")) {
36 foreach ($teachers as $teacher) {
37 $users["$teacher->id"] = "$teacher->firstname $teacher->lastname";
38 }
f9903ed0 39 }
40 }
720a43ce 41
42 if (isadmin()) {
43 if ($ccc = get_records_sql("SELECT * FROM course ORDER BY fullname")) {
44 foreach ($ccc as $cc) {
cfa5d3f2 45 if ($cc->category) {
46 $courses["$cc->id"] = "$cc->fullname";
47 } else {
48 $courses["$cc->id"] = " $cc->fullname (Site)";
49 }
720a43ce 50 }
f9903ed0 51 }
cfa5d3f2 52 asort($courses);
f9903ed0 53 }
54
55 asort($users);
56
57 // Get all the possible dates
9481285b 58 // Note that we are keeping track of real (GMT) time and user time
59 // User time is only used in displays - all calcs and passing is GMT
60
61 $timenow = time(); // GMT
62
63 // What day is it now for the user, and when is midnight that day (in GMT).
9604ccb1 64 $timemidnight = $today = usergetmidnight($timenow);
9481285b 65
66 // Put today up the top of the list
7a302afc 67 $dates = array("$timemidnight" => "Today, ".userdate($timenow, "%e %B %Y") );
9481285b 68
69 if (! $course->startdate) {
70 $course->startdate = $course->timecreated;
71 }
f9903ed0 72
9481285b 73 $numdates = 1;
74 while ($timemidnight > $course->startdate and $numdates < 365) {
f9903ed0 75 $timemidnight = $timemidnight - 86400;
9481285b 76 $timenow = $timenow - 86400;
7a302afc 77 $dates["$timemidnight"] = userdate($timenow, "%A, %e %B %Y");
9481285b 78 $numdates++;
f9903ed0 79 }
80
81 if ($selecteddate == "today") {
82 $selecteddate = $today;
83 }
84
85 echo "<CENTER>";
86 echo "<FORM ACTION=log.php METHOD=get>";
720a43ce 87 if (isadmin()) {
849bc02a 88 choose_from_menu ($courses, "id", $course->id, "");
720a43ce 89 } else {
90 echo "<INPUT TYPE=hidden NAME=id VALUE=\"$course->id\">";
91 }
92 if ($course->category) {
93 choose_from_menu ($users, "user", $selecteduser, "All participants");
94 }
f9903ed0 95 choose_from_menu ($dates, "date", $selecteddate, "Any day");
96 echo "<INPUT TYPE=submit VALUE=\"Show these logs\">";
97 echo "</FORM>";
98 echo "</CENTER>";
99}
100
600149be 101function make_log_url($module, $url) {
102 switch ($module) {
103 case "course":
104 case "user":
105 case "file":
106 case "login":
107 case "lib":
108 case "admin":
109 return "/$module/$url";
110 break;
111 default:
112 return "/mod/$module/$url";
113 break;
114 }
115}
116
117
f9903ed0 118function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
9481285b 119// It is assumed that $date is the GMT time of midnight for that day,
120// and so the next 86400 seconds worth of logs are printed.
f9903ed0 121
720a43ce 122 if ($course->category) {
123 $selector = "WHERE l.course='$course->id' AND l.user = u.id";
124 } else {
125 $selector = "WHERE l.user = u.id"; // Show all courses
126 if ($ccc = get_records_sql("SELECT * FROM course ORDER BY fullname")) {
127 foreach ($ccc as $cc) {
128 $courses[$cc->id] = "$cc->shortname";
129 }
130 }
131 }
f9903ed0 132
133 if ($user) {
134 $selector .= " AND l.user = '$user'";
135 }
136
137 if ($date) {
138 $enddate = $date + 86400;
139 $selector .= " AND l.time > '$date' AND l.time < '$enddate'";
140 }
141
142 if (!$logs = get_records_sql("SELECT l.*, u.firstname, u.lastname, u.picture
600149be 143 FROM log l, user u $selector $order")){
f9903ed0 144 notify("No logs found!");
145 print_footer($course);
146 exit;
147 }
148
149 $count=0;
150 $tt = getdate(time());
151 $today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
152 echo "<P ALIGN=CENTER>Displaying ".count($logs)." records</P>";
153 echo "<TABLE BORDER=0 ALIGN=center CELLPADDING=3 CELLSPACING=3>";
154 foreach ($logs as $log) {
600149be 155
156 if ($ld = get_record_sql("SELECT * FROM log_display WHERE module='$log->module' AND action='$log->action'")) {
157 $log->info = get_field($ld->table, $ld->field, "id", $log->info);
158 }
159
f9903ed0 160 echo "<TR>";
720a43ce 161 if (! $course->category) {
162 echo "<TD><FONT SIZE=2><A HREF=\"view.php?id=$log->course\">".$courses[$log->course]."</A></TD>";
163 }
7a302afc 164 echo "<TD ALIGN=right><FONT SIZE=2>".userdate($log->time, "%A")."</TD>";
165 echo "<TD><FONT SIZE=2>".userdate($log->time, "%e %B %Y, %I:%M %p")."</TD>";
f3ecd2c8 166 echo "<TD><FONT SIZE=2><A TITLE=\"$log->ip\" HREF=\"../user/view.php?id=$log->user&course=$log->course\"><B>$log->firstname $log->lastname</B></TD>";
f9903ed0 167 echo "<TD><FONT SIZE=2>";
600149be 168 link_to_popup_window( make_log_url($log->module,$log->url), "fromloglive","$log->module $log->action", 400, 600);
f9903ed0 169 echo "</TD>";
600149be 170 echo "<TD><FONT SIZE=2>$log->info</TD>";
f9903ed0 171 echo "</TR>";
172 }
173 echo "</TABLE>";
174}
175
176
d887b5a7 177function print_all_courses($cat=1) {
178
179 if ($courses = get_records("course", "category", $cat, "fullname ASC")) {
180 foreach ($courses as $course) {
181 print_course($course);
182 echo "<BR>\n";
183 }
184
185 } else {
186 echo "<H3>No courses have been defined yet</H3>";
187 }
188}
189
190
f9903ed0 191function print_course($course) {
192
d887b5a7 193 global $CFG;
194
a83fded1 195 if (! $site = get_site()) {
f9903ed0 196 error("Could not find a site!");
197 }
198
d887b5a7 199 print_simple_box_start("CENTER", "100%");
f9903ed0 200
201 echo "<TABLE WIDTH=100%>";
da5c172a 202 echo "<TR VALIGN=top>";
203 echo "<TD VALIGN=top WIDTH=50%>";
7a302afc 204 echo "<P><FONT SIZE=3><B><A TITLE=\"".get_string("entercourse")."\"
9481285b 205 HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</A></B></FONT></P>";
f9903ed0 206 if ($teachers = get_records_sql("SELECT u.* FROM user u, user_teachers t
207 WHERE u.id = t.user AND t.course = '$course->id'
f51ab26b 208 ORDER BY t.authority ASC")) {
f9903ed0 209
210 echo "<P><FONT SIZE=1>\n";
211 foreach ($teachers as $teacher) {
d887b5a7 212 echo "$course->teacher: <A HREF=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname</A><BR>";
f9903ed0 213 }
214 echo "</FONT></P>";
da5c172a 215 }
216 if ($course->guest or ($course->password == "")) {
cbc14629 217 echo "<A TITLE=\"This course allows guest users\" HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
d887b5a7 218 echo "<IMG VSPACE=4 ALT=\"\" HEIGHT=16 WIDTH=16 BORDER=0 SRC=\"$CFG->wwwroot/user/user.gif\"></A>&nbsp;&nbsp;";
da5c172a 219 }
220 if ($course->password) {
cbc14629 221 echo "<A TITLE=\"This course requires an enrolment key\" HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
d887b5a7 222 echo "<IMG VSPACE=4 ALT=\"\" HEIGHT=16 WIDTH=16 BORDER=0 SRC=\"$CFG->wwwroot/pix/i/key.gif\"></A>";
da5c172a 223 }
224
225
226 echo "</TD><TD VALIGN=top WIDTH=50%>";
227 echo "<P><FONT SIZE=2>".text_to_html($course->summary)."</FONT></P>";
228 echo "</TD></TR>";
229 echo "</TABLE>";
f9903ed0 230
da5c172a 231 print_simple_box_end();
f9903ed0 232}
233
600149be 234function print_headline($text, $size=2) {
235 echo "<B><FONT SIZE=\"$size\">$text</FONT></B><BR>\n";
236}
237
238function print_recent_activity($course) {
239 // $course is an object
240 // This function trawls through the logs looking for
241 // anything new since the user's last login
242
243 global $CFG, $USER;
244
245 if (! $USER->lastlogin ) {
246 echo "<P>Welcome to the course! Here you will find a list of what's new since your last login.</P>";
247 return;
248 }
249
250 if (! $logs = get_records_sql("SELECT * FROM log WHERE time > '$USER->lastlogin' AND course = '$course->id' ORDER BY time ASC")) {
251 return;
252 }
253
254
255 // Firstly, have there been any new enrolments?
256
257 $heading = false;
258 $content = false;
259 foreach ($logs as $log) {
260 if ($log->module == "course" and $log->action == "enrol") {
261 if (! $heading) {
ef25340c 262 print_headline("New users:");
600149be 263 $heading = true;
264 $content = true;
265 }
266 $user = get_record("user", "id", $log->info);
ef25340c 267 echo "<P><FONT SIZE=1><A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A></FONT></P>";
600149be 268 }
269 }
270
271 // Next, have there been any changes to the course structure?
272
600149be 273 foreach ($logs as $log) {
274 if ($log->module == "course") {
275 if ($log->action == "add mod" or $log->action == "update mod" or $log->action == "delete mod") {
600149be 276 $info = split(" ", $log->info);
277 $modname = get_field($info[0], "name", "id", $info[1]);
278
600149be 279 switch ($log->action) {
280 case "add mod":
ef25340c 281 $changelist["$log->info"] = array ("operation" => "add", "text" => "Added a ".$info[0].":<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
600149be 282 break;
283 case "update mod":
ef25340c 284 if (! $changelist["$log->info"]) {
285 $changelist["$log->info"] = array ("operation" => "update", "text" => "Updated the ".$info[0].":<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
286 }
600149be 287 break;
288 case "delete mod":
ef25340c 289 if ($changelist["$log->info"]["operation"] == "add") {
290 $changelist["$log->info"] = NULL;
291 } else {
292 $changelist["$log->info"] = array ("operation" => "delete", "text" => "Deleted a ".$info[0]);
293 }
600149be 294 break;
295 }
ef25340c 296 }
297 }
298 }
299
300 if ($changelist) {
301 foreach ($changelist as $changeinfo => $change) {
302 if ($change) {
303 $changes[$changeinfo] = $change;
304 }
305 }
306 if (count($changes) > 0) {
307 print_headline("Course changes:");
308 $content = true;
309 foreach ($changes as $changeinfo => $change) {
310 echo "<P><FONT SIZE=1>".$change["text"]."</FONT></P>";
600149be 311 }
312 }
313 }
314
315
316 // Now all we need to know are the new posts.
317
ef25340c 318 $heading = false;
600149be 319 foreach ($logs as $log) {
320
501cdbd8 321 if ($log->module == "forum") {
600149be 322 $post = NULL;
323
36d4a9a1 324 if ($log->action == "add post") {
f9730aef 325 $post = get_record_sql("SELECT p.*, d.forum, u.firstname, u.lastname,
600149be 326 u.email, u.picture, u.id as userid
501cdbd8 327 FROM forum_discussions d, forum_posts p, user u
328 WHERE p.id = '$log->info' AND d.id = p.discussion AND p.user = u.id");
600149be 329
36d4a9a1 330 } else if ($log->action == "add discussion") {
f9730aef 331 $post = get_record_sql("SELECT p.*, d.forum, u.firstname, u.lastname,
600149be 332 u.email, u.picture, u.id as userid
501cdbd8 333 FROM forum_discussions d, forum_posts p, user u
600149be 334 WHERE d.id = '$log->info' AND d.firstpost = p.id AND p.user = u.id");
335 }
336
337 if ($post) {
f9730aef 338
339 $teacherpost = "";
340 if ($forum = get_record("forum", "id", $post->forum) ) {
341 if ($forum->type == "teacher") {
342 if (!isteacher($course->id)) {
343 continue;
344 } else {
345 $teacherpost = "COLOR=#666666";
346 }
347 }
348 }
600149be 349 if (! $heading) {
ef25340c 350 print_headline("Discussion Posts:");
600149be 351 $heading = true;
352 $content = true;
353 }
f9730aef 354 echo "<P><FONT SIZE=1 $teacherpost>$post->firstname $post->lastname:<BR>";
501cdbd8 355 echo "\"<A HREF=\"$CFG->wwwroot/mod/forum/$log->url\">";
600149be 356 if ($log->action == "add") {
ef25340c 357 echo "<B>$post->subject</B>";
600149be 358 } else {
ef25340c 359 echo "$post->subject";
600149be 360 }
ef25340c 361 echo "</A>\"</FONT></P>";
600149be 362 }
363
364 }
365 }
366
367 if (! $content) {
368 echo "<FONT SIZE=2>Nothing new since your last login</FONT>";
369 }
370
371}
372
e1360728 373
374function unenrol_student_in_course($user, $course) {
375 global $db;
376
377 return $db->Execute("DELETE FROM user_students WHERE user = '$user' AND course = '$course'");
378}
379
380
381
382function enrol_student_in_course($user, $course) {
383 global $db;
384
385 $timenow = time();
386
387 $rs = $db->Execute("INSERT INTO user_students (user, course, start, end, time)
388 VALUES ($user, $course, 0, 0, $timenow)");
389 if ($rs) {
390 return true;
391 } else {
392 return false;
393 }
394}
395
90845098 396function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modnamesused) {
397// Returns a number of useful structures for course displays
7468bf01 398
90845098 399 $mods = NULL; // course modules indexed by id
400 $modnames = NULL; // all course module names
401 $modnamesused = NULL; // course module names used
7468bf01 402
90845098 403 if ($allmods = get_records_sql("SELECT * FROM modules") ) {
404 foreach ($allmods as $mod) {
405 $modnames[$mod->name] = get_string("modulename", "$mod->name");
406 $modnamesplural[$mod->name] = get_string("modulenameplural", "$mod->name");
407 }
408 asort($modnames);
409 } else {
410 error("No modules are installed!");
411 }
412
413 if ($rawmods = get_records_sql("SELECT cm.*, m.name as modname
414 FROM modules m, course_modules cm
415 WHERE cm.course = '$courseid'
416 AND cm.deleted = '0'
417 AND cm.module = m.id") ) {
7468bf01 418 foreach($rawmods as $mod) { // Index the mods
419 $mods[$mod->id] = $mod;
90845098 420 $mods[$mod->id]->modfullname = $modnames[$mod->modname];
421 $modnamesused[$mod->modname] = $modnames[$mod->modname];
7468bf01 422 }
90845098 423 asort($modnamesused);
7468bf01 424 }
7468bf01 425}
426
427function get_all_sections($courseid) {
428
429 return get_records_sql("SELECT section, id, course, summary, sequence
430 FROM course_sections
431 WHERE course = '$courseid'
432 ORDER BY section");
433}
434
2b8cef80 435function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
436 global $CFG;
437 echo "<IMG BORDER=0 SRC=\"$CFG->wwwroot/course/loggraph.php?id=$course->id&user=$userid&type=$type&date=$date\">";
438}
439
11b0c469 440
441
442/// MODULE FUNCTIONS /////////////////////////////////////////////////////////////////
443
444function add_course_module($mod) {
445 GLOBAL $db;
446
447 $timenow = time();
448
449 if (!$rs = $db->Execute("INSERT into course_modules
450 SET course = '$mod->course',
451 module = '$mod->module',
452 instance = '$mod->instance',
453 section = '$mod->section',
454 added = '$timenow' ")) {
455 return 0;
456 }
457
458 // Get it out again - this is the most compatible way to determine the ID
459 if ($rs = $db->Execute("SELECT id FROM course_modules
460 WHERE module = $mod->module AND added = $timenow")) {
461 return $rs->fields[0];
462 } else {
463 return 0;
464 }
465
466}
467
468function add_mod_to_section($mod) {
469// Returns the course_sections ID where the mod is inserted
470 GLOBAL $db;
471
472 if ($cw = get_record_sql("SELECT * FROM course_sections
473 WHERE course = '$mod->course' AND section = '$mod->section'") ) {
474
475 if ($cw->sequence) {
476 $newsequence = "$cw->sequence,$mod->coursemodule";
477 } else {
478 $newsequence = "$mod->coursemodule";
479 }
480 if (!$rs = $db->Execute("UPDATE course_sections SET sequence = '$newsequence' WHERE id = '$cw->id'")) {
481 return 0;
482 } else {
483 return $cw->id; // Return course_sections ID that was used.
484 }
485
486 } else { // Insert a new record
487 if (!$rs = $db->Execute("INSERT into course_sections
488 SET course = '$mod->course',
489 section = '$mod->section',
490 summary = '',
491 sequence = '$mod->coursemodule' ")) {
492 return 0;
493 }
494 // Get it out again - this is the most compatible way to determine the ID
495 if ($rs = $db->Execute("SELECT id FROM course_sections
496 WHERE course = '$mod->course' AND section = '$mod->section'")) {
497 return $rs->fields[0];
498 } else {
499 return 0;
500 }
501 }
502}
503
504function delete_course_module($mod) {
505 return set_field("course_modules", "deleted", 1, "id", $mod);
506}
507
508function delete_mod_from_section($mod, $section) {
509 GLOBAL $db;
510
511 if ($cw = get_record("course_sections", "id", "$section") ) {
512
513 $modarray = explode(",", $cw->sequence);
514
515 if ($key = array_keys ($modarray, $mod)) {
516 array_splice($modarray, $key[0], 1);
517 $newsequence = implode(",", $modarray);
518 return set_field("course_sections", "sequence", $newsequence, "id", $cw->id);
519 } else {
520 return false;
521 }
522
523 } else {
524 return false;
525 }
526}
527
528
529function move_module($id, $move) {
530 GLOBAL $db;
531
532 if (!$move) {
533 return true;
534 }
535
536 if (! $cm = get_record("course_modules", "id", $id)) {
537 error("This course module doesn't exist");
538 }
539
540 if (! $thissection = get_record("course_sections", "id", $cm->section)) {
541 error("This course section doesn't exist");
542 }
543
544 $mods = explode(",", $thissection->sequence);
545
546 $len = count($mods);
547 $pos = array_keys($mods, $cm->id);
548 $thepos = $pos[0];
549
550 if ($len == 0 || count($pos) == 0 ) {
551 error("Very strange. Could not find the required module in this section.");
552 }
553
554 if ($len == 1) {
555 $first = true;
556 $last = true;
557 } else {
558 $first = ($thepos == 0);
559 $last = ($thepos == $len - 1);
560 }
561
562 if ($move < 0) { // Moving the module up
563
564 if ($first) {
565 if ($thissection->section == 1) { // First section, do nothing
566 return true;
567 } else { // Push onto end of previous section
568 $prevsectionnumber = $thissection->section - 1;
569 if (! $prevsection = get_record_sql("SELECT * FROM course_sections
570 WHERE course='$thissection->course'
571 AND section='$prevsectionnumber' ")) {
572 error("Previous section ($prevsection->id) doesn't exist");
573 }
574
575 if ($prevsection->sequence) {
576 $newsequence = "$prevsection->sequence,$cm->id";
577 } else {
578 $newsequence = "$cm->id";
579 }
580
581 if (! set_field("course_sections", "sequence", $newsequence, "id", $prevsection->id)) {
582 error("Previous section could not be updated");
583 }
584
585 if (! set_field("course_modules", "section", $prevsection->id, "id", $cm->id)) {
586 error("Module could not be updated");
587 }
588
589 array_splice($mods, 0, 1);
590 $newsequence = implode(",", $mods);
591 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
592 error("Module could not be updated");
593 }
594
595 return true;
596
597 }
598 } else { // move up within this section
599 $swap = $mods[$thepos-1];
600 $mods[$thepos-1] = $mods[$thepos];
601 $mods[$thepos] = $swap;
602
603 $newsequence = implode(",", $mods);
604 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
605 error("This section could not be updated");
606 }
607 return true;
608 }
609
610 } else { // Moving the module down
611
612 if ($last) {
613 $nextsectionnumber = $thissection->section + 1;
614 if ($nextsection = get_record_sql("SELECT * FROM course_sections
615 WHERE course='$thissection->course'
616 AND section='$nextsectionnumber' ")) {
617
618 if ($nextsection->sequence) {
619 $newsequence = "$cm->id,$nextsection->sequence";
620 } else {
621 $newsequence = "$cm->id";
622 }
623
624 if (! set_field("course_sections", "sequence", $newsequence, "id", $nextsection->id)) {
625 error("Next section could not be updated");
626 }
627
628 if (! set_field("course_modules", "section", $nextsection->id, "id", $cm->id)) {
629 error("Module could not be updated");
630 }
631
632 array_splice($mods, $thepos, 1);
633 $newsequence = implode(",", $mods);
634 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
635 error("This section could not be updated");
636 }
637 return true;
638
639 } else { // There is no next section, so just return
640 return true;
641
642 }
643 } else { // move down within this section
644 $swap = $mods[$thepos+1];
645 $mods[$thepos+1] = $mods[$thepos];
646 $mods[$thepos] = $swap;
647
648 $newsequence = implode(",", $mods);
649 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
650 error("This section could not be updated");
651 }
652 return true;
653 }
654 }
655}
656
90845098 657function make_editing_buttons($moduleid) {
658 $delete = get_string("delete");
659 $moveup = get_string("moveup");
660 $movedown = get_string("movedown");
661 $update = get_string("update");
662 return "&nbsp; &nbsp;
663 <A HREF=mod.php?delete=$moduleid><IMG
664 SRC=../pix/t/delete.gif BORDER=0 ALT=\"$delete\"></A>
665 <A HREF=mod.php?id=$moduleid&move=-1><IMG
666 SRC=../pix/t/up.gif BORDER=0 ALT=\"$moveup\"></A>
667 <A HREF=mod.php?id=$moduleid&move=1><IMG
668 SRC=../pix/t/down.gif BORDER=0 ALT=\"$movedown\"></A>
669 <A HREF=mod.php?update=$moduleid><IMG
670 SRC=../pix/t/edit.gif BORDER=0 ALT=\"$update\"></A>";
671}
672
673function print_side_block($heading="", $list=NULL, $footer="", $icons=NULL) {
674
675 echo "<TABLE WIDTH=100%>\n";
676 echo "<TR><TD COLSPAN=2><P><B><FONT SIZE=2>$heading</TD></TR>\n";
677 if ($list) {
678 foreach($list as $key => $string) {
679 echo "<TR><TD VALIGN=top WIDTH=12>";
680 if ($icons[$key]) {
681 echo $icons[$key];
682 } else {
683 echo "";
684 }
685 echo "</TD>\n<TD WIDTH=100% VALIGN=top>";
686 echo "<P><FONT SIZE=2>$string</FONT></P>";
687 echo "</TD></TR>\n";
688 }
689 }
690 if ($footer) {
691 echo "<TR><TD></TD><TD ALIGN=left><P><FONT SIZE=2>$footer</TD></TR>\n";
692 }
693 echo "</TABLE><BR>\n\n";
694}
11b0c469 695
f9903ed0 696?>