Changed to plural (directorypath-->directorypaths)
[moodle.git] / course / lib.php
CommitLineData
e4027ac9 1<?php // $Id$
97c270e9 2 // Library of useful functions
f9903ed0 3
f9903ed0 4
3d891989 5if (defined('COURSE_MAX_LOG_DISPLAY')) { // Being included again - should never happen!!
9ae687af 6 return;
7}
8
3d891989 9define('COURSE_MAX_LOG_DISPLAY', 150); // days
d9d1c35d 10
3d891989 11define('COURSE_MAX_LOGS_PER_PAGE', 1000); // records
1c0200e0 12
3d891989 13define('COURSE_LIVELOG_REFRESH', 60); // Seconds
87ffed0d 14
9e51847a 15define('COURSE_MAX_RECENT_PERIOD', 172800); // Two days, in seconds
cb29b020 16
17define('COURSE_MAX_SUMMARIES_PER_PAGE', 10); // courses
ef58b822 18
c2cb4545 19define("FRONTPAGENEWS", 0);
20define("FRONTPAGECOURSELIST", 1);
21define("FRONTPAGECATEGORYNAMES", 2);
f9903ed0 22
587510be 23function print_recent_selector_form($course, $advancedfilter=0, $selecteduser=0, $selecteddate="lastlogin",
4581271a 24 $mod="", $modid="activity/All", $modaction="", $selectedgroup="", $selectedsort="default") {
cb83c3cb 25
26 global $USER, $CFG;
27
cb83c3cb 28 $isteacher = isteacher($course->id);
587510be 29
30 if ($advancedfilter) {
31
32 // Get all the possible users
33 $users = array();
89adb174 34
65ee9c16 35 if ($courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname')) {
587510be 36 foreach ($courseusers as $courseuser) {
37 $users[$courseuser->id] = fullname($courseuser, $isteacher);
38 }
cb83c3cb 39 }
587510be 40 if ($guest = get_guest()) {
41 $users[$guest->id] = fullname($guest);
42 }
89adb174 43
587510be 44 if (isadmin()) {
45 if ($ccc = get_records("course", "", "", "fullname")) {
46 foreach ($ccc as $cc) {
47 if ($cc->category) {
48 $courses["$cc->id"] = "$cc->fullname";
49 } else {
50 $courses["$cc->id"] = " $cc->fullname (Site)";
89adb174 51 }
587510be 52 }
cb83c3cb 53 }
587510be 54 asort($courses);
55 }
4581271a 56
587510be 57 $activities = array();
cb83c3cb 58
587510be 59 $selectedactivity = $modid;
4581271a 60
587510be 61 if ($modinfo = unserialize($course->modinfo)) {
62 $section = 0;
63 if ($course->format == 'weeks') { // Body
64 $strsection = get_string("week");
65 } else {
66 $strsection = get_string("topic");
cb83c3cb 67 }
cb83c3cb 68
587510be 69 $activities["activity/All"] = "All activities";
70 $activities["activity/Assignments"] = "All assignments";
71 $activities["activity/Chats"] = "All chats";
72 $activities["activity/Forums"] = "All forums";
73 $activities["activity/Quizzes"] = "All quizzes";
74 $activities["activity/Workshops"] = "All workshops";
75
76 $activities["section/individual"] = "------------- Individual Activities --------------";
77
78 foreach ($modinfo as $mod) {
79 if ($mod->mod == "label") {
80 continue;
89adb174 81 }
9c08ad13 82 if (!$mod->visible and !$isteacher) {
83 continue;
84 }
85
587510be 86 if ($mod->section > 0 and $section <> $mod->section) {
87 $activities["section/$mod->section"] = "-------------- $strsection $mod->section --------------";
88 }
89 $section = $mod->section;
70fb7712 90 $mod->name = strip_tags(urldecode($mod->name));
587510be 91 if (strlen($mod->name) > 55) {
92 $mod->name = substr($mod->name, 0, 50)."...";
93 }
94 if (!$mod->visible) {
95 $mod->name = "(".$mod->name.")";
96 }
97 $activities["$mod->cm"] = $mod->name;
98
99 if ($mod->cm == $modid) {
100 $selectedactivity = "$mod->cm";
101 }
cb83c3cb 102 }
103 }
cb83c3cb 104
587510be 105 $strftimedate = get_string("strftimedate");
106 $strftimedaydate = get_string("strftimedaydate");
cb83c3cb 107
587510be 108 asort($users);
cb83c3cb 109
587510be 110 // Get all the possible dates
111 // Note that we are keeping track of real (GMT) time and user time
112 // User time is only used in displays - all calcs and passing is GMT
cb83c3cb 113
587510be 114 $timenow = time(); // GMT
cb83c3cb 115
587510be 116 // What day is it now for the user, and when is midnight that day (in GMT).
117 $timemidnight = $today = usergetmidnight($timenow);
cb83c3cb 118
587510be 119 $dates = array();
120 $dates["$USER->lastlogin"] = get_string("lastlogin").", ".userdate($USER->lastlogin, $strftimedate);
121 $dates["$timemidnight"] = get_string("today").", ".userdate($timenow, $strftimedate);
cb83c3cb 122
587510be 123 if (!$course->startdate or ($course->startdate > $timenow)) {
124 $course->startdate = $course->timecreated;
125 }
cb83c3cb 126
587510be 127 $numdates = 1;
128 while ($timemidnight > $course->startdate and $numdates < 365) {
129 $timemidnight = $timemidnight - 86400;
130 $timenow = $timenow - 86400;
131 $dates["$timemidnight"] = userdate($timenow, $strftimedaydate);
132 $numdates++;
133 }
cb83c3cb 134
587510be 135 if ($selecteddate == "lastlogin") {
136 $selecteddate = $USER->lastlogin;
137 }
138
139 echo '<form action="recent.php" method="get">';
140 echo '<input type=hidden name=chooserecent value="1">';
141 echo "<center>";
142 echo "<table>";
143
144 if (isadmin()) {
145 echo "<tr><td><b>" . get_string("courses") . "</b></td><td>";
146 choose_from_menu ($courses, "id", $course->id, "");
147 echo "</td></tr>";
148 } else {
149 echo "<input type=hidden name=id value=\"$course->id\">";
150 }
cb83c3cb 151
f5ffb87d 152 $sortfields = array("default" => get_string("bycourseorder"),"dateasc" => get_string("datemostrecentlast"), "datedesc" => get_string("datemostrecentfirst"));
4581271a 153
587510be 154 echo "<tr><td><b>" . get_string("participants") . "</b></td><td>";
155 choose_from_menu ($users, "user", $selecteduser, get_string("allparticipants") );
156 echo "</td>";
157
158 echo "<td align='right'><b>" . get_string("since") . "</b></td><td>";
159 choose_from_menu ($dates, "date", $selecteddate, get_string("alldays"));
4581271a 160 echo "</td></tr>";
4581271a 161
587510be 162 echo "<tr><td><b>" . get_string("activities") . "</b></td><td>";
163 choose_from_menu ($activities, "modid", $selectedactivity, "");
164 echo "</td>";
4581271a 165
587510be 166 echo "<td align='right'><b>" . get_string("sortby") . "</b></td><td>";
167 choose_from_menu ($sortfields, "sortby", $selectedsort, "");
168 echo "</td></tr>";
4581271a 169
587510be 170 echo '<tr>';
4581271a 171
587510be 172 $groupmode = groupmode($course);
4581271a 173
587510be 174 if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
175 if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
4581271a 176 echo '<td><b>';
587510be 177 if ($groupmode == VISIBLEGROUPS) {
178 print_string('groupsvisible');
179 } else {
180 print_string('groupsseparate');
181 }
182 echo ':</b></td><td>';
183 choose_from_menu($groups, "selectedgroup", $selectedgroup, get_string("allgroups"), "", "");
184 echo '</td>';
185 }
186 }
187
188
189 echo "<td colspan='2' align='right'>";
190 echo "<input type=submit value=\"".get_string("showrecent")."\">";
191 echo "</td></tr>";
192
193 echo "</table>";
194
195 $advancedlink = "<a href=\"$CFG->wwwroot/course/recent.php?id=$course->id&advancedfilter=0\">" . get_string("normalfilter") . "</a>";
196 print_heading($advancedlink);
197 echo "</center>";
198 echo "</form>";
199
200 } else {
201
202 $day_list = array("1","7","14","21","30");
203 $strsince = get_string("since");
204 $strlastlogin = get_string("lastlogin");
205 $strday = get_string("day");
206 $strdays = get_string("days");
207
208 $heading = "";
209 foreach ($day_list as $count) {
210 if ($count == "1") {
211 $day = $strday;
4581271a 212 } else {
587510be 213 $day = $strdays;
4581271a 214 }
3819ed31 215 $tmpdate = time() - ($count * 3600 * 24);
587510be 216 $heading = $heading .
3819ed31 217 "<a href=\"$CFG->wwwroot/course/recent.php?id=$course->id&date=$tmpdate\"> $count $day</a> | ";
4581271a 218 }
4581271a 219
587510be 220 $heading = $strsince . ": <a href=\"$CFG->wwwroot/course/recent.php?id=$course->id\">$strlastlogin</a>" . " | " . $heading;
221 print_heading($heading);
4581271a 222
587510be 223 $advancedlink = "<a href=\"$CFG->wwwroot/course/recent.php?id=$course->id&advancedfilter=1\">" . get_string("advancedfilter") . "</a>";
224 print_heading($advancedlink);
225
226 }
4581271a 227
cb83c3cb 228}
9ae687af 229
f24cffb9 230function print_log_selector_form($course, $selecteduser=0, $selecteddate="today",
69c76405 231 $modname="", $modid=0, $modaction="", $selectedgroup=-1) {
f9903ed0 232
9481285b 233 global $USER, $CFG;
234
69c76405 235 /// Setup for group handling.
2ac64806 236 $isteacher = isteacher($course->id);
69c76405 237 $isteacheredit = isteacheredit($course->id);
238 if ($course->groupmode == SEPARATEGROUPS and !$isteacheredit) {
239 $selectedgroup = get_current_group($course->id);
240 $showgroups = false;
241 }
242 else if ($course->groupmode) {
243 $selectedgroup = ($selectedgroup == -1) ? get_current_group($course->id) : $selectedgroup;
244 $showgroups = true;
245 }
246 else {
247 $selectedgroup = 0;
248 $showgroups = false;
249 }
250
f9903ed0 251 // Get all the possible users
252 $users = array();
720a43ce 253
254 if ($course->category) {
69c76405 255 /// If using a group, only get users in that group.
256 if ($selectedgroup) {
257 $sql = 'SELECT u.id as id, u.firstname, u.lastname, u.lastaccess '.
258 'FROM '.$CFG->prefix.'user u,'.$CFG->prefix.'user_students us,'.$CFG->prefix.'groups_members gm, '.
259 $CFG->prefix.'user_teachers ut '.
260 'WHERE us.course='.$course->id.' AND gm.groupid='.$selectedgroup.
261 ' AND (gm.userid=us.userid OR gm.userid=ut.userid) AND gm.userid=u.id';
262 $courseusers = get_records_sql($sql);
65ee9c16 263 } else {
264 $courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname');
69c76405 265 }
1a5ab449 266 } else {
267 $courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname");
268 }
269
270 if ($courseusers) {
271 foreach ($courseusers as $courseuser) {
2ac64806 272 $users[$courseuser->id] = fullname($courseuser, $isteacher);
122cffc9 273 }
f9903ed0 274 }
1a5ab449 275 if ($guest = get_guest()) {
f5104a2b 276 $users[$guest->id] = fullname($guest);
1a5ab449 277 }
720a43ce 278
279 if (isadmin()) {
9fa49e22 280 if ($ccc = get_records("course", "", "", "fullname")) {
720a43ce 281 foreach ($ccc as $cc) {
cfa5d3f2 282 if ($cc->category) {
283 $courses["$cc->id"] = "$cc->fullname";
284 } else {
285 $courses["$cc->id"] = " $cc->fullname (Site)";
286 }
720a43ce 287 }
f9903ed0 288 }
cfa5d3f2 289 asort($courses);
f9903ed0 290 }
291
f24cffb9 292 $activities = array();
293 $selectedactivity = "";
294
295 if ($modinfo = unserialize($course->modinfo)) {
296 $section = 0;
297 if ($course->format == 'weeks') { // Bodgy
298 $strsection = get_string("week");
299 } else {
300 $strsection = get_string("topic");
301 }
302 foreach ($modinfo as $mod) {
303 if ($mod->mod == "label") {
304 continue;
305 }
306 if ($mod->section > 0 and $section <> $mod->section) {
307 $activities["section/$mod->section"] = "-------------- $strsection $mod->section --------------";
308 }
309 $section = $mod->section;
69c76405 310 $mod->name = urldecode($mod->name);
f24cffb9 311 if (strlen($mod->name) > 55) {
312 $mod->name = substr($mod->name, 0, 50)."...";
313 }
314 if (!$mod->visible) {
315 $mod->name = "(".$mod->name.")";
316 }
69d79bc3 317 $activities["$mod->cm"] = $mod->name;
f24cffb9 318
319 if ($mod->cm == $modid) {
69d79bc3 320 $selectedactivity = "$mod->cm";
f24cffb9 321 }
322 }
69c76405 323
324 if (isadmin() && !$course->category) {
325 $activities["site_errors"] = get_string("siteerrors");
326 if ($modid === "site_errors") {
327 $selectedactivity = "site_errors";
328 }
329 }
f24cffb9 330 }
69c76405 331
dcde9f02 332
333 $strftimedate = get_string("strftimedate");
334 $strftimedaydate = get_string("strftimedaydate");
335
f9903ed0 336 asort($users);
337
338 // Get all the possible dates
9481285b 339 // Note that we are keeping track of real (GMT) time and user time
340 // User time is only used in displays - all calcs and passing is GMT
341
342 $timenow = time(); // GMT
343
344 // What day is it now for the user, and when is midnight that day (in GMT).
9604ccb1 345 $timemidnight = $today = usergetmidnight($timenow);
9481285b 346
347 // Put today up the top of the list
dcde9f02 348 $dates = array("$timemidnight" => get_string("today").", ".userdate($timenow, $strftimedate) );
9481285b 349
3695f5b4 350 if (!$course->startdate or ($course->startdate > $timenow)) {
9481285b 351 $course->startdate = $course->timecreated;
352 }
f9903ed0 353
9481285b 354 $numdates = 1;
355 while ($timemidnight > $course->startdate and $numdates < 365) {
f9903ed0 356 $timemidnight = $timemidnight - 86400;
9481285b 357 $timenow = $timenow - 86400;
dcde9f02 358 $dates["$timemidnight"] = userdate($timenow, $strftimedaydate);
9481285b 359 $numdates++;
f9903ed0 360 }
361
362 if ($selecteddate == "today") {
363 $selecteddate = $today;
364 }
365
f24cffb9 366 echo '<center>';
367 echo '<form action="log.php" method="get">';
368 echo '<input type=hidden name=chooselog value="1">';
720a43ce 369 if (isadmin()) {
849bc02a 370 choose_from_menu ($courses, "id", $course->id, "");
720a43ce 371 } else {
f24cffb9 372 echo "<input type=hidden name=id value=\"$course->id\">";
720a43ce 373 }
69c76405 374
375 if ($showgroups) {
376 $cgroups = get_groups($course->id);
377 foreach ($cgroups as $cgroup) {
378 $groups[$cgroup->id] = $cgroup->name;
379 }
380 choose_from_menu ($groups, "group", $selectedgroup, get_string("allgroups") );
381 }
382
1a5ab449 383 choose_from_menu ($users, "user", $selecteduser, get_string("allparticipants") );
97c270e9 384 choose_from_menu ($dates, "date", $selecteddate, get_string("alldays"));
69d79bc3 385 choose_from_menu ($activities, "modid", $selectedactivity, get_string("allactivities"), "", "");
f24cffb9 386 echo "<input type=submit value=\"".get_string("showtheselogs")."\">";
387 echo "</form>";
388 echo "</center>";
f9903ed0 389}
390
600149be 391function make_log_url($module, $url) {
392 switch ($module) {
de2dfe68 393 case "user":
600149be 394 case "course":
395 case "user":
396 case "file":
397 case "login":
398 case "lib":
399 case "admin":
400 return "/$module/$url";
401 break;
de2dfe68 402 case "library":
403 case "":
404 return "/";
405 break;
600149be 406 default:
407 return "/mod/$module/$url";
408 break;
409 }
410}
411
69c76405 412function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $perpage=100,
413 $url="", $modname="", $modid=0, $modaction="", $groupid=0) {
f24cffb9 414
e0161bff 415 // It is assumed that $date is the GMT time of midnight for that day,
416 // and so the next 86400 seconds worth of logs are printed.
f9903ed0 417
f24cffb9 418 global $CFG, $db;
47f1da80 419
69c76405 420 /// Setup for group handling.
421 $isteacher = isteacher($course->id);
422 $isteacheredit = isteacheredit($course->id);
423
424 /// If the group mode is separate, and this user does not have editing privileges,
425 /// then only the user's group can be viewed.
426 if ($course->groupmode == SEPARATEGROUPS and !$isteacheredit) {
427 $groupid = get_current_group($course->id);
428 }
429 /// If this course doesn't have groups, no groupid can be specified.
430 else if (!$course->groupmode) {
431 $groupid = 0;
432 }
433
e0161bff 434 $joins = array();
a2ab3b05 435
e0161bff 436 if ($course->category) {
437 $joins[] = "l.course='$course->id'";
720a43ce 438 } else {
2eb68e6f 439 $courses[0] = '';
1a5ab449 440 if ($ccc = get_courses("all", "c.id ASC", "c.id,c.shortname")) {
720a43ce 441 foreach ($ccc as $cc) {
442 $courses[$cc->id] = "$cc->shortname";
443 }
444 }
445 }
f9903ed0 446
c469a7ef 447 if ($modname) {
e0161bff 448 $joins[] = "l.module = '$modname'";
f24cffb9 449 }
450
e21922f0 451 if ('site_errors' === $modid) {
e0161bff 452 $joins[] = "l.action='error'";
e21922f0 453 } else if ($modid) {
454 $joins[] = "l.cmid = '$modid'";
69d79bc3 455 }
456
457 if ($modaction) {
e0161bff 458 $joins[] = "l.action = '$modaction'";
f24cffb9 459 }
460
69c76405 461 /// Getting all members of a group.
462 if ($groupid and !$user) {
463 if ($gusers = get_records('groups_members', 'groupid', $groupid)) {
464 $first = true;
465 foreach($gusers as $guser) {
466 if ($first) {
467 $gselect = '(l.userid='.$guser->userid;
468 $first = false;
469 }
470 else {
471 $gselect .= ' OR l.userid='.$guser->userid;
472 }
473 }
474 if (!$first) $gselect .= ')';
475 $joins[] = $gselect;
476 }
477 }
478 else if ($user) {
e0161bff 479 $joins[] = "l.userid = '$user'";
f9903ed0 480 }
481
482 if ($date) {
483 $enddate = $date + 86400;
e0161bff 484 $joins[] = "l.time > '$date' AND l.time < '$enddate'";
f9903ed0 485 }
486
2828ff51 487 $selector = '';
e0161bff 488 for ($i = 0; $i < count($joins); $i++) {
489 $selector .= $joins[$i] . (($i == count($joins)-1) ? " " : " AND ");
490 }
491
492
d09f3c80 493 $totalcount = 0; // Initialise
494
519d369f 495 if (!$logs = get_logs($selector, $order, $page*$perpage, $perpage, $totalcount)) {
f9903ed0 496 notify("No logs found!");
497 print_footer($course);
498 exit;
499 }
500
501 $count=0;
2eb68e6f 502 $ldcache = array();
f9903ed0 503 $tt = getdate(time());
504 $today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
1c0200e0 505
dcde9f02 506 $strftimedatetime = get_string("strftimedatetime");
2ac64806 507 $isteacher = isteacher($course->id);
dcde9f02 508
f9d5fd3b 509 echo "<p align=center>";
519d369f 510 print_string("displayingrecords", "", $totalcount);
f9d5fd3b 511 echo "</p>";
1c0200e0 512
519d369f 513 print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&");
514
2eb68e6f 515 echo '<table border=0 align=center cellpadding=3 cellspacing=3>';
f9903ed0 516 foreach ($logs as $log) {
600149be 517
2eb68e6f 518 if (isset($ldcache[$log->module][$log->action])) {
519 $ld = $ldcache[$log->module][$log->action];
520 } else {
521 $ld = get_record('log_display', 'module', $log->module, "action", $log->action);
522 $ldcache[$log->module][$log->action] = $ld;
523 }
524 if ($ld) {
525 $log->info = get_field($ld->mtable, $ld->field, 'id', $log->info);
600149be 526 }
527
d7d145b1 528 $log->url = strip_tags(urldecode($log->url)); // Some XSS protection
529 $log->info = strip_tags(urldecode($log->info)); // Some XSS protection
530
2eb68e6f 531 echo '<tr nowrap="nowrap">';
720a43ce 532 if (! $course->category) {
2eb68e6f 533 echo '<td nowrap="nowrap"><font size=2><a href="view.php?id='.$log->course.'">'.$courses[$log->course].'</a></td>';
720a43ce 534 }
2eb68e6f 535 echo '<td nowrap align=right><font size=2>'.userdate($log->time, '%a').'</td>';
536 echo '<td nowrap><font size=2>'.userdate($log->time, $strftimedatetime).'</td>';
537 echo '<td nowrap><font size=2>';
538 link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", 'ipatlas',$log->ip, 400, 700);
539 echo '</td>';
2ac64806 540 $fullname = fullname($log, $isteacher);
2eb68e6f 541 echo '<td nowrap><font size=2><a href="../user/view.php?id='."$log->userid&course=$log->course".'"><b>'.$fullname.'</b></td>';
542 echo '<td nowrap><font size=2>';
543 link_to_popup_window( make_log_url($log->module,$log->url), 'fromloglive',"$log->module $log->action", 400, 600);
544 echo '</td>';
545 echo '<td nowrap><font size=2>'.$log->info.'</td>';
546 echo '</tr>';
f9903ed0 547 }
2eb68e6f 548 echo '</table>';
519d369f 549
550 print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&");
f9903ed0 551}
552
553
c2cb4545 554function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
555 global $CFG;
556 if (empty($CFG->gdversion)) {
557 echo "(".get_string("gdneed").")";
d887b5a7 558 } else {
c2cb4545 559 echo "<IMG BORDER=0 SRC=\"$CFG->wwwroot/course/loggraph.php?id=$course->id&user=$userid&type=$type&date=$date\">";
d887b5a7 560 }
561}
562
563
f9903ed0 564
600149be 565function print_recent_activity($course) {
566 // $course is an object
89adb174 567 // This function trawls through the logs looking for
600149be 568 // anything new since the user's last login
569
bf40f9c1 570 global $CFG, $USER, $THEME, $SESSION;
600149be 571
2ac64806 572 $isteacher = isteacher($course->id);
573
6f80940b 574 $timestart = time() - COURSE_MAX_RECENT_PERIOD;
0f87cb1d 575
9e51847a 576 if (!empty($USER->timeaccess[$course->id])) {
6f80940b 577 if ($USER->timeaccess[$course->id] > $timestart) {
9e51847a 578 $timestart = $USER->timeaccess[$course->id];
579 }
3d891989 580 }
0f87cb1d 581
0f87cb1d 582 echo '<center><font size="1">';
583 echo get_string("activitysince", "", userdate($timestart));
584
761b1f84 585 echo '<p><a href="'.$CFG->wwwroot.'/course/recent.php?id='.$course->id.'">'.get_string('recentactivityreport').'</a></p>';
0f87cb1d 586
587 echo '</font></center>';
588
600149be 589
590 // Firstly, have there been any new enrolments?
591
592 $heading = false;
593 $content = false;
1b5910c4 594
6c38b7e0 595 $users = get_recent_enrolments($course->id, $timestart);
1b5910c4 596
6c38b7e0 597 if ($users) {
e2b7251d 598 echo "<p>";
6c38b7e0 599 foreach ($users as $user) {
600149be 600 if (! $heading) {
4c654ee3 601 print_headline(get_string("newusers").":");
600149be 602 $heading = true;
603 $content = true;
604 }
2ac64806 605 $fullname = fullname($user, $isteacher);
761b1f84 606 echo '<font size=1><a href="'.$CFG->wwwroot."/user/view.php?id=$user->id&course=$course->id\">$fullname</a></font><br />";
600149be 607 }
e2b7251d 608 echo "</p>";
600149be 609 }
610
1b5910c4 611 // Next, have there been any modifications to the course structure?
612
89adb174 613 $logs = get_records_select("log", "time > '$timestart' AND course = '$course->id' AND
1b5910c4 614 module = 'course' AND action LIKE '% mod'", "time ASC");
615
616 if ($logs) {
617 foreach ($logs as $key => $log) {
618 $info = split(" ", $log->info);
c9f6251e 619
620 if ($info[0] == "label") { // Labels are special activities
621 continue;
622 }
623
1b5910c4 624 $modname = get_field($info[0], "name", "id", $info[1]);
625 //Create a temp valid module structure (course,id)
626 $tempmod->course = $log->course;
627 $tempmod->id = $info[1];
628 //Obtain the visible property from the instance
629 $modvisible = instance_is_visible($info[0],$tempmod);
89adb174 630
1b5910c4 631 //Only if the mod is visible
632 if ($modvisible) {
633 switch ($log->action) {
634 case "add mod":
635 $stradded = get_string("added", "moodle", get_string("modulename", $info[0]));
636 $changelist["$log->info"] = array ("operation" => "add", "text" => "$stradded:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
637 break;
638 case "update mod":
639 $strupdated = get_string("updated", "moodle", get_string("modulename", $info[0]));
640 if (empty($changelist["$log->info"])) {
641 $changelist["$log->info"] = array ("operation" => "update", "text" => "$strupdated:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
642 }
643 break;
644 case "delete mod":
89adb174 645 if (!empty($changelist["$log->info"]["operation"]) and
1b5910c4 646 $changelist["$log->info"]["operation"] == "add") {
647 $changelist["$log->info"] = NULL;
648 } else {
649 $strdeleted = get_string("deletedactivity", "moodle", get_string("modulename", $info[0]));
650 $changelist["$log->info"] = array ("operation" => "delete", "text" => $strdeleted);
651 }
652 break;
600149be 653 }
ef25340c 654 }
655 }
656 }
657
9c9f7d77 658 if (!empty($changelist)) {
ef25340c 659 foreach ($changelist as $changeinfo => $change) {
660 if ($change) {
661 $changes[$changeinfo] = $change;
662 }
663 }
8a59942e 664 if (isset($changes)){
665 if (count($changes) > 0) {
666 print_headline(get_string("courseupdates").":");
667 $content = true;
668 foreach ($changes as $changeinfo => $change) {
669 echo "<p><font size=1>".$change["text"]."</font></p>";
670 }
600149be 671 }
672 }
89adb174 673 }
bf40f9c1 674
675
676 // If this site uses Library module, then print recent items
677 if (!empty($CFG->librarypath)) {
678 if (file_exists("$CFG->dirroot/$CFG->librarypath/librarylib.php")) {
679 include_once("$CFG->dirroot/$CFG->librarypath/librarylib.php");
680 if (librarysummarize(5, '', date('YmdHis',$USER->lastlogin))) {
681 $content = true;
682 }
683 }
600149be 684 }
685
3869a2ac 686 // Now display new things from each module
600149be 687
0fd7da81 688 $mods = get_records("modules", "visible", "1", "name", "id, name");
689
1b5910c4 690 foreach ($mods as $mod) { // Each module gets it's own logs and prints them
0fd7da81 691 include_once("$CFG->dirroot/mod/$mod->name/lib.php");
692 $print_recent_activity = $mod->name."_print_recent_activity";
1b5910c4 693 if (function_exists($print_recent_activity)) {
694 $modcontent = $print_recent_activity($course, $isteacher, $timestart);
3869a2ac 695 if ($modcontent) {
696 $content = true;
600149be 697 }
600149be 698 }
699 }
700
701 if (! $content) {
3d891989 702 echo "<font size=2>".get_string("nothingnew")."</font>";
600149be 703 }
600149be 704}
705
e1360728 706
d897cae4 707function get_array_of_activities($courseid) {
89adb174 708// For a given course, returns an array of course activity objects
d897cae4 709// Each item in the array contains he following properties:
710// cm - course module id
711// mod - name of the module (eg forum)
712// section - the number of the section (eg week or topic)
713// name - the name of the instance
5867bfb5 714// visible - is the instance visible or not
86aa7ccf 715// extra - contains extra string to include in any link
d897cae4 716
8dddba42 717 global $CFG;
718
d897cae4 719 $mod = array();
720
9fa49e22 721 if (!$rawmods = get_course_mods($courseid)) {
d897cae4 722 return NULL;
723 }
724
725 if ($sections = get_records("course_sections", "course", $courseid, "section ASC")) {
726 foreach ($sections as $section) {
74666583 727 if (!empty($section->sequence)) {
d897cae4 728 $sequence = explode(",", $section->sequence);
729 foreach ($sequence as $seq) {
7af6281f 730 if (empty($rawmods[$seq])) {
731 continue;
732 }
d897cae4 733 $mod[$seq]->cm = $rawmods[$seq]->id;
734 $mod[$seq]->mod = $rawmods[$seq]->modname;
735 $mod[$seq]->section = $section->section;
736 $mod[$seq]->name = urlencode(get_field($rawmods[$seq]->modname, "name", "id", $rawmods[$seq]->instance));
fec5a6a6 737 $mod[$seq]->visible = $rawmods[$seq]->visible;
86aa7ccf 738 $mod[$seq]->extra = "";
8dddba42 739
740 $modname = $mod[$seq]->mod;
741 $functionname = $modname."_get_coursemodule_info";
742
743 include_once("$CFG->dirroot/mod/$modname/lib.php");
744
745 if (function_exists($functionname)) {
9d361034 746 if ($info = $functionname($rawmods[$seq])) {
747 if (!empty($info->extra)) {
748 $mod[$seq]->extra = $info->extra;
749 }
750 if (!empty($info->icon)) {
751 $mod[$seq]->icon = $info->icon;
752 }
c9f6251e 753 }
754 }
d897cae4 755 }
756 }
757 }
758 }
759 return $mod;
760}
761
762
763
e1360728 764
90845098 765function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modnamesused) {
766// Returns a number of useful structures for course displays
7468bf01 767
90845098 768 $mods = NULL; // course modules indexed by id
e0161bff 769 $modnames = NULL; // all course module names (except resource!)
94361e02 770 $modnamesplural= NULL; // all course module names (plural form)
90845098 771 $modnamesused = NULL; // course module names used
7468bf01 772
9fa49e22 773 if ($allmods = get_records("modules")) {
90845098 774 foreach ($allmods as $mod) {
5867bfb5 775 if ($mod->visible) {
776 $modnames[$mod->name] = get_string("modulename", "$mod->name");
777 $modnamesplural[$mod->name] = get_string("modulenameplural", "$mod->name");
778 }
90845098 779 }
780 asort($modnames);
781 } else {
782 error("No modules are installed!");
783 }
784
9fa49e22 785 if ($rawmods = get_course_mods($courseid)) {
7468bf01 786 foreach($rawmods as $mod) { // Index the mods
787 $mods[$mod->id] = $mod;
90845098 788 $mods[$mod->id]->modfullname = $modnames[$mod->modname];
1acfbce5 789 if ($mod->visible or isteacher($courseid)) {
790 $modnamesused[$mod->modname] = $modnames[$mod->modname];
791 }
7468bf01 792 }
c7da6f7a 793 if ($modnamesused) {
794 asort($modnamesused);
795 }
7468bf01 796 }
e0161bff 797
798 unset($modnames['resource']);
799 unset($modnames['label']);
7468bf01 800}
801
9fa49e22 802
7468bf01 803function get_all_sections($courseid) {
89adb174 804
805 return get_records("course_sections", "course", "$courseid", "section",
7d99d695 806 "section, id, course, summary, sequence, visible");
7468bf01 807}
808
b86fc0e2 809function course_set_display($courseid, $display=0) {
810 global $USER;
811
812 if (empty($USER)) {
813 return false;
814 }
815
816 if ($display == "all" or empty($display)) {
817 $display = 0;
818 }
819
820 if (record_exists("course_display", "userid", $USER->id, "course", $courseid)) {
821 set_field("course_display", "display", $display, "userid", $USER->id, "course", $courseid);
822 } else {
823 $record->userid = $USER->id;
824 $record->course = $courseid;
825 $record->display = $display;
826 if (!insert_record("course_display", $record)) {
827 notify("Could not save your course display!");
828 }
829 }
830
831 return $USER->display[$courseid] = $display; // Note: = not ==
832}
833
7d99d695 834function set_section_visible($courseid, $sectionnumber, $visibility) {
835/// For a given course section, markes it visible or hidden,
836/// and does the same for every activity in that section
837
838 if ($section = get_record("course_sections", "course", $courseid, "section", $sectionnumber)) {
839 set_field("course_sections", "visible", "$visibility", "id", $section->id);
840 if (!empty($section->sequence)) {
841 $modules = explode(",", $section->sequence);
842 foreach ($modules as $moduleid) {
dcd338ff 843 if ($visibility) {
844 show_course_module($moduleid);
845 } else {
846 hide_course_module($moduleid);
847 }
7d99d695 848 }
849 }
5867bfb5 850 rebuild_course_cache($courseid);
7d99d695 851 }
852}
ba2e5d73 853
5e367a2d 854
d897cae4 855function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%") {
52dcc2f9 856/// Prints a section full of activity modules
7977cffd 857 global $CFG, $USER;
858
3d575e6f 859 static $groupbuttons;
32d03b7b 860 static $groupbuttonslink;
52dcc2f9 861 static $isteacher;
862 static $isediting;
7977cffd 863 static $ismoving;
864 static $strmovehere;
865 static $strmovefull;
52dcc2f9 866
a22f8313 867 $labelformatoptions = New stdClass;
110a32e2 868
52dcc2f9 869 if (!isset($isteacher)) {
9fd9c29b 870 $groupbuttons = ($course->groupmode or (!$course->groupmodeforce));
32d03b7b 871 $groupbuttonslink = (!$course->groupmodeforce);
52dcc2f9 872 $isteacher = isteacher($course->id);
52dcc2f9 873 $isediting = isediting($course->id);
7977cffd 874 $ismoving = ismoving($course->id);
3d575e6f 875 if ($ismoving) {
876 $strmovehere = get_string("movehere");
877 $strmovefull = strip_tags(get_string("movefull", "", "'$USER->activitycopyname'"));
878 }
179c9a50 879 $labelformatoptions->noclean = true;
7977cffd 880 }
94361e02 881
c408b0c4 882 $modinfo = unserialize($course->modinfo);
94361e02 883
89adb174 884 echo '<table width="'.$width.'" cellpadding="1" cellspacing="0">';
74666583 885 if (!empty($section->sequence)) {
94361e02 886
887 $sectionmods = explode(",", $section->sequence);
888
889 foreach ($sectionmods as $modnumber) {
9ae687af 890 if (empty($mods[$modnumber])) {
891 continue;
892 }
94361e02 893 $mod = $mods[$modnumber];
c9f6251e 894
52dcc2f9 895 if ($mod->visible or $isteacher) {
c9f6251e 896 echo "<tr><td class=\"activity$mod->modname\">";
7977cffd 897 if ($ismoving) {
898 if ($mod->id == $USER->activitycopy) {
899 continue;
900 }
6951a894 901 echo "<a title=\"$strmovefull\"".
5fc2f2fd 902 " href=\"$CFG->wwwroot/course/mod.php?moveto=$mod->id\">".
6951a894 903 "<img height=\"16\" width=\"80\" src=\"$CFG->pixpath/movehere.gif\" ".
904 " alt=\"$strmovehere\" border=\"0\"></a><br />\n";
1acfbce5 905 }
7977cffd 906 $instancename = urldecode($modinfo[$modnumber]->name);
3c89f9a8 907 if (!empty($CFG->filterall)) {
b346b424 908 $instancename = filter_text("<nolink>$instancename</nolink>", $course->id);
3c89f9a8 909 }
c9f6251e 910
86aa7ccf 911 if (!empty($modinfo[$modnumber]->extra)) {
912 $extra = urldecode($modinfo[$modnumber]->extra);
913 } else {
914 $extra = "";
915 }
c9f6251e 916
9d361034 917 if (!empty($modinfo[$modnumber]->icon)) {
918 $icon = "$CFG->pixpath/".urldecode($modinfo[$modnumber]->icon);
919 } else {
920 $icon = "$CFG->modpixpath/$mod->modname/icon.gif";
921 }
922
aac94fd0 923 if ($mod->indent) {
924 print_spacer(12, 20 * $mod->indent, false);
925 }
926
c9f6251e 927 if ($mod->modname == "label") {
aac94fd0 928 if (!$mod->visible) {
929 echo "<span class=\"dimmed_text\">";
930 }
179c9a50 931 echo format_text($extra, FORMAT_HTML, $labelformatoptions);
aac94fd0 932 if (!$mod->visible) {
933 echo "</span>";
934 }
c9f6251e 935
936 } else { // Normal activity
937 $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
9d361034 938 echo "<img src=\"$icon\"".
c9f6251e 939 " height=16 width=16 alt=\"$mod->modfullname\">".
940 " <font size=2><a title=\"$mod->modfullname\" $linkcss $extra".
941 " href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a></font>";
942 }
c9f6251e 943 if ($isediting) {
32d03b7b 944 if ($groupbuttons) {
945 if (! $mod->groupmodelink = $groupbuttonslink) {
946 $mod->groupmode = $course->groupmode;
947 }
948
949 } else {
3d575e6f 950 $mod->groupmode = false;
951 }
ffc69cd3 952 echo "&nbsp;&nbsp;";
3d575e6f 953 echo make_editing_buttons($mod, $absolute, true, $mod->indent);
c9f6251e 954 }
ffc69cd3 955 echo "</td>";
c9f6251e 956 echo "</tr>";
94361e02 957 }
94361e02 958 }
959 }
7977cffd 960 if ($ismoving) {
6951a894 961 echo "<tr><td><a title=\"$strmovefull\"".
78bf3de3 962 " href=\"$CFG->wwwroot/course/mod.php?movetosection=$section->id\">".
6951a894 963 "<img height=\"16\" width=\"80\" src=\"$CFG->pixpath/movehere.gif\" ".
964 " alt=\"$strmovehere\" border=\"0\"></a></td></tr>\n";
7977cffd 965 }
c9f6251e 966 echo "</table>\n\n";
a7ad3ea6 967}
968
5867bfb5 969
cb57e6f4 970function print_section_add_menus($course, $section, $modnames, $vertical=false, $return=false) {
e0161bff 971// Prints the menus to add activities and resources
972
2e2a6351 973 global $CFG;
6da4b261 974 static $straddactivity, $stractivities, $straddresource, $resources;
e0161bff 975
976 if (!isset($straddactivity)) {
977 $straddactivity = get_string('addactivity');
978 $straddresource = get_string('addresource');
6da4b261 979
980 /// Standard resource types
981 require_once("$CFG->dirroot/mod/resource/lib.php");
982 $resourceraw = resource_get_resource_types();
983
984 foreach ($resourceraw as $type => $name) {
985 $resources["resource&type=$type"] = $name;
e0161bff 986 }
e0161bff 987 $resources['label'] = get_string('resourcetypelabel', 'resource');
988 }
989
cb57e6f4 990 $output = '';
991
992 $output .= '<div align="right"><table align="right"><tr><td>';
993 $output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section&add=",
6da4b261 994 $resources, "ressection$section", "", $straddresource, 'resource/types', $straddresource, true);
cb57e6f4 995 $output .= '</td>';
996
997 if ($vertical) {
998 $output .= '</tr><tr>';
999 }
1000
1001 $output .= '<td>';
1002 $output .= popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section&add=",
6da4b261 1003 $modnames, "section$section", "", $straddactivity, 'mods', $straddactivity, true);
cb57e6f4 1004 $output .= '</td></tr></table>';
1005 $output .= '</div>';
1006
1007 if ($return) {
1008 return $output;
1009 } else {
1010 echo $output;
1011 }
e0161bff 1012}
1013
5867bfb5 1014function rebuild_course_cache($courseid=0) {
1015// Rebuilds the cached list of course activities stored in the database
1016// If a courseid is not specified, then all are rebuilt
1017
1018 if ($courseid) {
1019 $select = "id = '$courseid'";
1020 } else {
1021 $select = "";
1022 }
1023
1024 if ($courses = get_records_select("course", $select)) {
1025 foreach ($courses as $course) {
1026 $modinfo = serialize(get_array_of_activities($course->id));
1027 if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
1028 notify("Could not cache module information for course '$course->fullname'!");
1029 }
1030 }
1031 }
1032}
1033
1034
7541bc3e 1035function print_heading_block($heading, $width="100%", $class="headingblock") {
5e367a2d 1036 global $THEME;
1037
7541bc3e 1038 echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
1039 echo "<tr><td bgcolor=\"$THEME->cellheading\" class=\"$class\">";
5e367a2d 1040 echo stripslashes($heading);
1041 echo "</td></tr></table>";
5e367a2d 1042}
1043
c2cb4545 1044
1045function make_categories_list(&$list, &$parents, $category=NULL, $path="") {
89adb174 1046/// Given an empty array, this function recursively travels the
c2cb4545 1047/// categories, building up a nice list for display. It also makes
1048/// an array that list all the parents for each category.
1049
1050 if ($category) {
1051 if ($path) {
1052 $path = "$path / $category->name";
1053 } else {
1054 $path = "$category->name";
1055 }
1056 $list[$category->id] = $path;
1057 } else {
1058 $category->id = 0;
1059 }
1060
1061 if ($categories = get_categories("$category->id")) { // Print all the children recursively
1062 foreach ($categories as $cat) {
1063 if (!empty($category->id)) {
3bd4de22 1064 if (isset($parents[$category->id])) {
2832badf 1065 $parents[$cat->id] = $parents[$category->id];
1066 }
c2cb4545 1067 $parents[$cat->id][] = $category->id;
1068 }
89adb174 1069 make_categories_list($list, $parents, $cat, $path);
c2cb4545 1070 }
1071 }
1072}
1073
1074
c2cb4545 1075function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1) {
89adb174 1076/// Recursive function to print out all the categories in a nice format
c2cb4545 1077/// with or without courses included
9ff5310a 1078 global $CFG;
1079 if (isset($CFG->max_category_depth)&&($depth >= $CFG->max_category_depth)) {
1080 return;
1081 }
c2cb4545 1082
1083 if (!$displaylist) {
e92fe848 1084 make_categories_list($displaylist, $parentslist);
c2cb4545 1085 }
1086
1087 if ($category) {
3af6e1db 1088 if ($category->visible or iscreator()) {
d2b6ba70 1089 print_category_info($category, $depth);
c2cb4545 1090 } else {
1091 return; // Don't bother printing children of invisible categories
1092 }
89adb174 1093
c2cb4545 1094 } else {
c2cb4545 1095 $category->id = "0";
1096 }
1097
1098 if ($categories = get_categories($category->id)) { // Print all the children recursively
1099 $countcats = count($categories);
1100 $count = 0;
1101 $first = true;
1102 $last = false;
1103 foreach ($categories as $cat) {
1104 $count++;
1105 if ($count == $countcats) {
1106 $last = true;
1107 }
1108 $up = $first ? false : true;
1109 $down = $last ? false : true;
1110 $first = false;
1111
89adb174 1112 print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1);
c2cb4545 1113 }
1114 }
c2cb4545 1115}
1116
1117
d2b6ba70 1118function print_category_info($category, $depth) {
1119/// Prints the category info in indented fashion
1120/// This function is only used by print_whole_category_list() above
c2cb4545 1121
1122 global $CFG;
b48f834c 1123 static $strallowguests, $strrequireskey, $strsummary;
c2cb4545 1124
b48f834c 1125 if (empty($strsummary)) {
1126 $strallowguests = get_string("allowguests");
1127 $strrequireskey = get_string("requireskey");
1128 $strsummary = get_string("summary");
1129 }
ba2e5d73 1130
d5f26b07 1131 $catlinkcss = $category->visible ? "" : " class=\"dimmed\" ";
1132
8ef9cb56 1133 if ($CFG->frontpage == FRONTPAGECOURSELIST) {
c9f6251e 1134 $catimage = "<img src=\"$CFG->pixpath/i/course.gif\" width=16 height=16 border=0>";
b48f834c 1135 } else {
1136 $catimage = "&nbsp";
8ef9cb56 1137 }
b48f834c 1138
1139 echo "\n\n<table border=0 cellpadding=3 cellspacing=0 width=\"100%\"><tr>";
d2b6ba70 1140
c2cb4545 1141 if ($CFG->frontpage == FRONTPAGECOURSELIST) {
b48f834c 1142 $courses = get_courses($category->id);
1143
1144 echo "<tr>";
1145
1146 if ($depth) {
1147 $indent = $depth*30;
1148 $rows = count($courses) + 1;
1149 echo "<td rowspan=\"$rows\" valign=\"top\" width=\"$indent\">";
1150 print_spacer(10, $indent);
1151 echo "</td>";
1152 }
89adb174 1153
b48f834c 1154 echo "<td valign=\"top\">$catimage</td>";
cb29b020 1155 echo "<td valign=\"top\" width=\"100%\" class=\"categoryname\">";
b48f834c 1156 echo "<a $catlinkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a>";
cb29b020 1157 echo "</td>";
1158 echo "<td class=\"categoryname\">&nbsp;</td>";
b48f834c 1159 echo "</tr>\n";
1160
9ff5310a 1161 if ($courses && !(isset($CFG->max_category_depth)&&($depth>=$CFG->max_category_depth-1))) {
c2cb4545 1162 foreach ($courses as $course) {
1163 $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
b48f834c 1164 echo "<tr><td valign=\"top\" width=\"30\">&nbsp;";
cb29b020 1165 echo "</td>\n<td valign=\"top\" width=\"100%\" class=\"coursename\">";
a6870f0c 1166 echo "<a $linkcss href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
cb29b020 1167 echo "</td>\n<td align=\"right\" valign=\"top\" nowrap class=\"coursename\">";
c2cb4545 1168 if ($course->guest ) {
1169 echo "<a title=\"$strallowguests\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
9928b09e 1170 echo "<img hspace=1 alt=\"$strallowguests\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/guest.gif\"></a>";
ebe8ddc1 1171 } else {
c9f6251e 1172 echo "<img alt=\"\" height=16 width=18 border=0 src=\"$CFG->pixpath/spacer.gif\">";
0c656181 1173 }
c2cb4545 1174 if ($course->password) {
1175 echo "<a title=\"$strrequireskey\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
9928b09e 1176 echo "<img hspace=1 alt=\"$strrequireskey\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/key.gif\"></a>";
ebe8ddc1 1177 } else {
c9f6251e 1178 echo "<img alt=\"\" height=16 width=18 border=0 src=\"$CFG->pixpath/spacer.gif\">";
b48f834c 1179 }
1180 if ($course->summary) {
89adb174 1181 link_to_popup_window ("/course/info.php?id=$course->id", "courseinfo",
1182 "<img hspace=1 alt=\"$strsummary\" height=16 width=16 border=0 src=\"$CFG->pixpath/i/info.gif\">",
b48f834c 1183 400, 500, $strsummary);
ebe8ddc1 1184 } else {
c9f6251e 1185 echo "<img alt=\"\" height=16 width=18 border=0 src=\"$CFG->pixpath/spacer.gif\">";
0c656181 1186 }
b48f834c 1187 echo "</td></tr>\n";
0c656181 1188 }
ba2e5d73 1189 }
d2b6ba70 1190 } else {
b48f834c 1191
1192 if ($depth) {
1193 $indent = $depth*20;
1194 echo "<td valign=\"top\" width=\"$indent\">";
1195 print_spacer(10, $indent);
1196 echo "</td>";
d2b6ba70 1197 }
89adb174 1198
cb29b020 1199 echo "<td valign=\"top\" width=\"100%\" class=\"categoryname\">";
b48f834c 1200 echo "<a $catlinkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a>";
cb29b020 1201 echo "</td>";
a0456978 1202 echo "<td valign=\"top\" class=\"categorynumber\">$category->coursecount</td></tr>";
c2cb4545 1203 }
b48f834c 1204 echo "\n</table>\n";
c2cb4545 1205}
1206
c2cb4545 1207
c2cb4545 1208function print_courses($category, $width="100%") {
1209/// Category is 0 (for all courses) or an object
1210
1211 global $CFG, $THEME;
1212
1213 if (empty($category)) {
90c2ca2e 1214 $categories = get_categories(0); // Parent = 0 ie top-level categories only
1215 if (count($categories) == 1) {
1216 $category = array_shift($categories);
d2b6ba70 1217 $courses = get_courses($category->id);
90c2ca2e 1218 } else {
d2b6ba70 1219 $courses = get_courses("all");
90c2ca2e 1220 }
1221 unset($categories);
607809b3 1222 } else {
c2cb4545 1223 $categories = get_categories($category->id); // sub categories
d2b6ba70 1224 $courses = get_courses($category->id);
c2cb4545 1225 }
1226
c2cb4545 1227 if ($courses) {
1228 foreach ($courses as $course) {
1229 print_course($course, $width);
1230 echo "<br />\n";
1231 }
1232 } else {
1233 print_heading(get_string("nocoursesyet"));
1234 }
1235
1236}
1237
1238
1239function print_course($course, $width="100%") {
1240
1241 global $CFG, $THEME;
1242
146bbb8f 1243 static $enrol;
1244
1245 if (empty($enrol)) {
1246 require_once("$CFG->dirroot/enrol/$CFG->enrol/enrol.php");
1247 $enrol = new enrolment_plugin;
1248 }
1249
1b6a4b1d 1250 print_simple_box_start("center", "$width", $THEME->cellcontent, 5, "coursebox");
c2cb4545 1251
22288704 1252 $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
1253
c2cb4545 1254 echo "<table width=\"100%\">";
1255 echo "<tr valign=top>";
1b6a4b1d 1256 echo "<td valign=top width=\"50%\" class=\"courseboxinfo\">";
89adb174 1257 echo "<p><font size=3><b><a title=\"".get_string("entercourse")."\"
22288704 1258 $linkcss href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a></b></font></p>";
c2cb4545 1259 if ($teachers = get_course_teachers($course->id)) {
1260 echo "<p><font size=\"1\">\n";
1261 foreach ($teachers as $teacher) {
1262 if ($teacher->authority > 0) {
1263 if (!$teacher->role) {
1264 $teacher->role = $course->teacher;
1265 }
2ac64806 1266 $fullname = fullname($teacher, isteacher($course->id)); // is the USER a teacher of that course
222ac91b 1267 echo "$teacher->role: <a href=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=".SITEID."\">$fullname</a><br />";
c2cb4545 1268 }
1269 }
1270 echo "</font></p>";
1271 }
c2cb4545 1272
146bbb8f 1273 echo $enrol->get_access_icons($course);
c2cb4545 1274
1b6a4b1d 1275 echo "</td><td valign=top width=\"50%\" class=\"courseboxsummary\">";
0d0e550f 1276 echo "<p><font size=2>".filter_text(text_to_html($course->summary), $course->id)."</font></p>";
c2cb4545 1277 echo "</td></tr>";
1278 echo "</table>";
1279
1280 print_simple_box_end();
1281}
1282
1283
1284function print_my_moodle() {
1285/// Prints custom user information on the home page.
1286/// Over time this can include all sorts of information
1287
1288 global $USER, $CFG;
1289
1290 if (!isset($USER->id)) {
1291 error("It shouldn't be possible to see My Moodle without being logged in.");
1292 }
1293
1294 if ($courses = get_my_courses($USER->id)) {
1295 foreach ($courses as $course) {
c81696e5 1296 if (!$course->category) {
1297 continue;
1298 }
c2cb4545 1299 print_course($course, "100%");
1300 echo "<br />\n";
1301 }
38a10939 1302
7f989948 1303 if (count_records("course") > (count($courses) + 1) ) { // Some courses not being displayed
1304 echo "<table width=\"100%\"><tr><td align=\"center\">";
1305 print_course_search("", false, "short");
1306 echo "</td><td align=\"center\">";
1307 print_single_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get");
1308 echo "</td></tr></table>\n";
1309 }
26330001 1310 } else {
1311 if (count_records("course_categories") > 1) {
cb29b020 1312 print_simple_box_start("center", "100%", "#FFFFFF", 5, "categorybox");
26330001 1313 print_whole_category_list();
1314 print_simple_box_end();
1315 } else {
1316 print_courses(0, "100%");
1317 }
607809b3 1318 }
2b8cef80 1319}
1320
11b0c469 1321
a8b56716 1322function print_course_search($value="", $return=false, $format="plain") {
38a10939 1323
1324 global $CFG;
1325
1326 $strsearchcourses= get_string("searchcourses");
1327
a8b56716 1328 if ($format == "plain") {
1329 $output = "<center><p align=\"center\" class=\"coursesearchbox\">";
1330 $output .= "<form name=\"coursesearch\" action=\"$CFG->wwwroot/course/search.php\" method=\"get\">";
1331 $output .= "<input type=\"text\" size=30 name=\"search\" value=\"$value\">";
1332 $output .= "<input type=\"submit\" value=\"$strsearchcourses\">";
1333 $output .= "</form></p></center>";
e4027ac9 1334 } else if ($format == "short") {
1335 $output = "<center><p align=\"center\" class=\"coursesearchbox\">";
1336 $output .= "<form name=\"coursesearch\" action=\"$CFG->wwwroot/course/search.php\" method=\"get\">";
1337 $output .= "<input type=\"text\" size=12 name=\"search\" value=\"$value\">";
1338 $output .= "<input type=\"submit\" value=\"$strsearchcourses\">";
1339 $output .= "</form></p></center>";
a8b56716 1340 } else if ($format == "navbar") {
1341 $output = "<table border=0 cellpadding=0 cellspacing=0><tr><td nowrap>";
1342 $output .= "<form name=\"coursesearch\" action=\"$CFG->wwwroot/course/search.php\" method=\"get\">";
1343 $output .= "<input type=\"text\" size=20 name=\"search\" value=\"$value\">";
1344 $output .= "<input type=\"submit\" value=\"$strsearchcourses\">";
a8b56716 1345 $output .= "</form>";
1346 $output .= "</td></tr></table>";
1347 }
1348
1349 if ($return) {
1350 return $output;
1351 }
1352 echo $output;
38a10939 1353}
11b0c469 1354
1355/// MODULE FUNCTIONS /////////////////////////////////////////////////////////////////
1356
1357function add_course_module($mod) {
11b0c469 1358
e5dfd0f3 1359 $mod->added = time();
53f4ad2c 1360 unset($mod->id);
11b0c469 1361
e5dfd0f3 1362 return insert_record("course_modules", $mod);
11b0c469 1363}
1364
7977cffd 1365function add_mod_to_section($mod, $beforemod=NULL) {
1366/// Given a full mod object with section and course already defined
1367/// If $before is specified, then this is an existing ID which we
1368/// will insert the new module before
1369///
1370/// Returns the course_sections ID where the mod is inserted
11b0c469 1371
9fa49e22 1372 if ($section = get_record("course_sections", "course", "$mod->course", "section", "$mod->section")) {
7977cffd 1373
1374 $section->sequence = trim($section->sequence);
1375
1376 if (empty($section->sequence)) {
11b0c469 1377 $newsequence = "$mod->coursemodule";
7977cffd 1378
1379 } else if ($beforemod) {
1380 $modarray = explode(",", $section->sequence);
1381
1382 if ($key = array_keys ($modarray, $beforemod->id)) {
1383 $insertarray = array($mod->id, $beforemod->id);
1384 array_splice($modarray, $key[0], 1, $insertarray);
1385 $newsequence = implode(",", $modarray);
1386
1387 } else { // Just tack it on the end anyway
1388 $newsequence = "$section->sequence,$mod->coursemodule";
1389 }
1390
1391 } else {
1392 $newsequence = "$section->sequence,$mod->coursemodule";
11b0c469 1393 }
89adb174 1394
e5dfd0f3 1395 if (set_field("course_sections", "sequence", $newsequence, "id", $section->id)) {
1396 return $section->id; // Return course_sections ID that was used.
11b0c469 1397 } else {
e5dfd0f3 1398 return 0;
11b0c469 1399 }
89adb174 1400
11b0c469 1401 } else { // Insert a new record
e5dfd0f3 1402 $section->course = $mod->course;
1403 $section->section = $mod->section;
1404 $section->summary = "";
1405 $section->sequence = $mod->coursemodule;
1406 return insert_record("course_sections", $section);
11b0c469 1407 }
1408}
1409
3d575e6f 1410function set_groupmode_for_module($id, $groupmode) {
1411 return set_field("course_modules", "groupmode", $groupmode, "id", $id);
1412}
1413
1acfbce5 1414function hide_course_module($mod) {
dcd338ff 1415 $cm = get_record('course_modules', 'id', $mod);
1416 $modulename = get_field('modules', 'name', 'id', $cm->module);
1417 if ($events = get_records_select('event', "instance = '$cm->instance' AND modulename = '$modulename'")) {
1418 foreach($events as $event) {
1419 hide_event($event);
1420 }
1421 }
1acfbce5 1422 return set_field("course_modules", "visible", 0, "id", $mod);
1423}
1424
1425function show_course_module($mod) {
dcd338ff 1426 $cm = get_record('course_modules', 'id', $mod);
1427 $modulename = get_field('modules', 'name', 'id', $cm->module);
1428 if ($events = get_records_select('event', "instance = '$cm->instance' AND modulename = '$modulename'")) {
1429 foreach($events as $event) {
1430 show_event($event);
1431 }
1432 }
1acfbce5 1433 return set_field("course_modules", "visible", 1, "id", $mod);
1434}
1435
11b0c469 1436function delete_course_module($mod) {
1437 return set_field("course_modules", "deleted", 1, "id", $mod);
1438}
1439
1440function delete_mod_from_section($mod, $section) {
11b0c469 1441
e5dfd0f3 1442 if ($section = get_record("course_sections", "id", "$section") ) {
11b0c469 1443
e5dfd0f3 1444 $modarray = explode(",", $section->sequence);
11b0c469 1445
1446 if ($key = array_keys ($modarray, $mod)) {
1447 array_splice($modarray, $key[0], 1);
1448 $newsequence = implode(",", $modarray);
e5dfd0f3 1449 return set_field("course_sections", "sequence", $newsequence, "id", $section->id);
11b0c469 1450 } else {
1451 return false;
1452 }
89adb174 1453
11b0c469 1454 }
7977cffd 1455 return false;
11b0c469 1456}
1457
12905134 1458function move_section($course, $section, $move) {
1459/// Moves a whole course section up and down within the course
1460
1461 if (!$move) {
1462 return true;
1463 }
1464
1465 $sectiondest = $section + $move;
1466
1467 if ($sectiondest > $course->numsections or $sectiondest < 1) {
1468 return false;
1469 }
1470
1471 if (!$sectionrecord = get_record("course_sections", "course", $course->id, "section", $section)) {
1472 return false;
1473 }
1474
1475 if (!$sectiondestrecord = get_record("course_sections", "course", $course->id, "section", $sectiondest)) {
1476 return false;
1477 }
1478
56e34ee4 1479 if (!set_field("course_sections", "section", $sectiondest, "id", $sectionrecord->id)) {
12905134 1480 return false;
1481 }
56e34ee4 1482 if (!set_field("course_sections", "section", $section, "id", $sectiondestrecord->id)) {
12905134 1483 return false;
1484 }
1485 return true;
1486}
1487
1488
7977cffd 1489function moveto_module($mod, $section, $beforemod=NULL) {
1490/// All parameters are objects
1491/// Move the module object $mod to the specified $section
1492/// If $beforemod exists then that is the module
1493/// before which $modid should be inserted
1494
1495/// Remove original module from original section
1496
1497 if (! delete_mod_from_section($mod->id, $mod->section)) {
1498 notify("Could not delete module from existing section");
1499 }
1500
1501/// Update module itself if necessary
1502
1503 if ($mod->section != $section->id) {
89adb174 1504 $mod->section = $section->id;
7977cffd 1505
1506 if (!update_record("course_modules", $mod)) {
1507 return false;
1508 }
1509 }
1510
1511/// Add the module into the new section
1512
1513 $mod->course = $section->course;
1514 $mod->section = $section->section; // need relative reference
1515 $mod->coursemodule = $mod->id;
1516
1517 if (! add_mod_to_section($mod, $beforemod)) {
1518 return false;
1519 }
1520
1521 return true;
1522
1523}
1524
1525
11b0c469 1526
7c0f2984 1527function move_module($cm, $move) {
12905134 1528/// Moves an activity module up and down within the course
11b0c469 1529
1530 if (!$move) {
1531 return true;
1532 }
1533
11b0c469 1534 if (! $thissection = get_record("course_sections", "id", $cm->section)) {
1535 error("This course section doesn't exist");
1536 }
1537
1538 $mods = explode(",", $thissection->sequence);
1539
1540 $len = count($mods);
1541 $pos = array_keys($mods, $cm->id);
1542 $thepos = $pos[0];
1543
1544 if ($len == 0 || count($pos) == 0 ) {
1545 error("Very strange. Could not find the required module in this section.");
1546 }
1547
1548 if ($len == 1) {
1549 $first = true;
1550 $last = true;
1551 } else {
1552 $first = ($thepos == 0);
1553 $last = ($thepos == $len - 1);
1554 }
1555
1556 if ($move < 0) { // Moving the module up
1557
1558 if ($first) {
ad41694c 1559 if ($thissection->section == 0) { // First section, do nothing
11b0c469 1560 return true;
ad41694c 1561
11b0c469 1562 } else { // Push onto end of previous section
1563 $prevsectionnumber = $thissection->section - 1;
89adb174 1564 if (! $prevsection = get_record("course_sections", "course", "$thissection->course",
9fa49e22 1565 "section", "$prevsectionnumber")) {
11b0c469 1566 error("Previous section ($prevsection->id) doesn't exist");
1567 }
1568
74666583 1569 if (!empty($prevsection->sequence)) {
11b0c469 1570 $newsequence = "$prevsection->sequence,$cm->id";
1571 } else {
1572 $newsequence = "$cm->id";
1573 }
1574
1575 if (! set_field("course_sections", "sequence", $newsequence, "id", $prevsection->id)) {
1576 error("Previous section could not be updated");
1577 }
1578
1579 if (! set_field("course_modules", "section", $prevsection->id, "id", $cm->id)) {
1580 error("Module could not be updated");
1581 }
1582
1583 array_splice($mods, 0, 1);
1584 $newsequence = implode(",", $mods);
1585 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1586 error("Module could not be updated");
1587 }
1588
1589 return true;
1590
1591 }
1592 } else { // move up within this section
1593 $swap = $mods[$thepos-1];
1594 $mods[$thepos-1] = $mods[$thepos];
1595 $mods[$thepos] = $swap;
89adb174 1596
11b0c469 1597 $newsequence = implode(",", $mods);
1598 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1599 error("This section could not be updated");
1600 }
1601 return true;
1602 }
1603
1604 } else { // Moving the module down
1605
1606 if ($last) {
1607 $nextsectionnumber = $thissection->section + 1;
89adb174 1608 if ($nextsection = get_record("course_sections", "course", "$thissection->course",
9fa49e22 1609 "section", "$nextsectionnumber")) {
11b0c469 1610
74666583 1611 if (!empty($nextsection->sequence)) {
11b0c469 1612 $newsequence = "$cm->id,$nextsection->sequence";
1613 } else {
1614 $newsequence = "$cm->id";
1615 }
1616
1617 if (! set_field("course_sections", "sequence", $newsequence, "id", $nextsection->id)) {
1618 error("Next section could not be updated");
1619 }
1620
1621 if (! set_field("course_modules", "section", $nextsection->id, "id", $cm->id)) {
1622 error("Module could not be updated");
1623 }
1624
1625 array_splice($mods, $thepos, 1);
1626 $newsequence = implode(",", $mods);
1627 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1628 error("This section could not be updated");
1629 }
1630 return true;
1631
1632 } else { // There is no next section, so just return
1633 return true;
1634
1635 }
1636 } else { // move down within this section
1637 $swap = $mods[$thepos+1];
1638 $mods[$thepos+1] = $mods[$thepos];
1639 $mods[$thepos] = $swap;
89adb174 1640
11b0c469 1641 $newsequence = implode(",", $mods);
1642 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1643 error("This section could not be updated");
1644 }
1645 return true;
1646 }
1647 }
1648}
1649
3d575e6f 1650function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-1) {
dc0dc7d5 1651 global $CFG, $THEME;
94361e02 1652
3d575e6f 1653 static $str;
1654
1655 if (!isset($str)) {
1656 $str->delete = get_string("delete");
1657 $str->move = get_string("move");
1658 $str->moveup = get_string("moveup");
1659 $str->movedown = get_string("movedown");
1660 $str->moveright = get_string("moveright");
1661 $str->moveleft = get_string("moveleft");
1662 $str->update = get_string("update");
d33a2a6f 1663 $str->duplicate = get_string("duplicate");
3d575e6f 1664 $str->hide = get_string("hide");
1665 $str->show = get_string("show");
1666 $str->clicktochange = get_string("clicktochange");
32d03b7b 1667 $str->forcedmode = get_string("forcedmode");
3d575e6f 1668 $str->groupsnone = get_string("groupsnone");
1669 $str->groupsseparate = get_string("groupsseparate");
1670 $str->groupsvisible = get_string("groupsvisible");
1acfbce5 1671 }
94361e02 1672
1673 if ($absolute) {
dc0dc7d5 1674 $path = "$CFG->wwwroot/course";
1675 } else {
1676 $path = ".";
1677 }
1678
1679 if (empty($THEME->custompix)) {
1680 $pixpath = "$path/../pix";
94361e02 1681 } else {
dc0dc7d5 1682 $pixpath = "$path/../theme/$CFG->theme/pix";
94361e02 1683 }
1acfbce5 1684
3d575e6f 1685 if ($mod->visible) {
1686 $hideshow = "<a title=\"$str->hide\" href=\"$path/mod.php?hide=$mod->id\"><img".
dbcd54b7 1687 " src=\"$pixpath/t/hide.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" alt=\"$str->hide\"></a> ";
1acfbce5 1688 } else {
3d575e6f 1689 $hideshow = "<a title=\"$str->show\" href=\"$path/mod.php?show=$mod->id\"><img".
dbcd54b7 1690 " src=\"$pixpath/t/show.gif\" hspace=\"2\" height=\"11\" width=\"11\" ".
1691 "border=\"0\" alt=\"$str->show\"></a> ";
7977cffd 1692 }
3d575e6f 1693 if ($mod->groupmode !== false) {
1694 if ($mod->groupmode == SEPARATEGROUPS) {
32d03b7b 1695 $grouptitle = $str->groupsseparate;
1696 $groupimage = "$pixpath/t/groups.gif";
1697 $grouplink = "$path/mod.php?id=$mod->id&groupmode=0";
3d575e6f 1698 } else if ($mod->groupmode == VISIBLEGROUPS) {
32d03b7b 1699 $grouptitle = $str->groupsvisible;
1700 $groupimage = "$pixpath/t/groupv.gif";
1701 $grouplink = "$path/mod.php?id=$mod->id&groupmode=1";
1702 } else {
1703 $grouptitle = $str->groupsnone;
1704 $groupimage = "$pixpath/t/groupn.gif";
1705 $grouplink = "$path/mod.php?id=$mod->id&groupmode=2";
1706 }
1707 if ($mod->groupmodelink) {
1708 $groupmode = "<a title=\"$grouptitle ($str->clicktochange)\" href=\"$grouplink\">".
dbcd54b7 1709 "<img src=\"$groupimage\" hspace=\"2\" height=\"11\" width=\"11\" ".
1710 "border=\"0\" alt=\"$grouptitle\"></a>";
3d575e6f 1711 } else {
32d03b7b 1712 $groupmode = "<img title=\"$grouptitle ($str->forcedmode)\" ".
dbcd54b7 1713 " src=\"$groupimage\" hspace=\"2\" height=\"11\" width=\"11\" ".
1714 "border=\"0\" alt=\"$grouptitle\">";
3d575e6f 1715 }
1716 } else {
1717 $groupmode = "";
1718 }
7977cffd 1719
1720 if ($moveselect) {
3d575e6f 1721 $move = "<a title=\"$str->move\" href=\"$path/mod.php?copy=$mod->id\"><img".
dbcd54b7 1722 " src=\"$pixpath/t/move.gif\" hspace=\"2\" height=\"11\" width=\"11\" ".
1723 " border=\"0\" alt=\"$str->move\"></a>";
493486c4 1724 } else {
3d575e6f 1725 $move = "<a title=\"$str->moveup\" href=\"$path/mod.php?id=$mod->id&move=-1\"><img".
dbcd54b7 1726 " src=\"$pixpath/t/up.gif\" hspace=\"2\" height=\"11\" width=\"11\" ".
1727 " border=\"0\" alt=\"$str->moveup\"></a>".
3d575e6f 1728 "<a title=\"$str->movedown\" href=\"$path/mod.php?id=$mod->id&move=1\"><img".
dbcd54b7 1729 " src=\"$pixpath/t/down.gif\" hspace=\"2\" height=\"11\" width=\"11\" ".
1730 " border=\"0\" alt=\"$str->movedown\"></a>";
7977cffd 1731 }
1732
aac94fd0 1733 $leftright = "";
1734 if ($indent > 0) {
3d575e6f 1735 $leftright .= "<a title=\"$str->moveleft\" href=\"$path/mod.php?id=$mod->id&indent=-1\"><img".
dbcd54b7 1736 " src=\"$pixpath/t/left.gif\" hspace=\"2\" height=\"11\" width=\"11\" ".
1737 " border=\"0\" alt=\"$str->moveleft\"></a>";
aac94fd0 1738 }
1739 if ($indent >= 0) {
3d575e6f 1740 $leftright .= "<a title=\"$str->moveright\" href=\"$path/mod.php?id=$mod->id&indent=1\"><img".
dbcd54b7 1741 " src=\"$pixpath/t/right.gif\" hspace=\"2\" height=\"11\" width=\"11\" ".
1742 " border=\"0\" alt=\"$str->moveright\"></a>";
aac94fd0 1743 }
1744
bf1241ad 1745 return "$leftright$move".
3d575e6f 1746 "<a title=\"$str->update\" href=\"$path/mod.php?update=$mod->id\"><img".
dbcd54b7 1747 " src=\"$pixpath/t/edit.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" ".
1748 " alt=\"$str->update\"></a>".
d4bfbe4d 1749 // Following line is commented out until this feature is more definite -- martin
1750 // "<a title=\"$str->duplicate\" href=\"$path/mod.php?duplicate=$mod->id\"> 2 </a>".
3d575e6f 1751 "<a title=\"$str->delete\" href=\"$path/mod.php?delete=$mod->id\"><img".
dbcd54b7 1752 " src=\"$pixpath/t/delete.gif\" hspace=\"2\" height=\"11\" width=\"11\" border=\"0\" ".
1753 " alt=\"$str->delete\"></a>$hideshow$groupmode";
90845098 1754}
1755
f9903ed0 1756?>