Added new style for hidden topics as well as some docs about
[moodle.git] / course / lib.php
CommitLineData
f9903ed0 1<? // $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
10a95b43 15define('COURSE_MAX_RECENT_PERIOD', 604800); // A week, in seconds
ef58b822 16
f9903ed0 17
9ae687af 18
f9903ed0 19function print_log_selector_form($course, $selecteduser=0, $selecteddate="today") {
20
9481285b 21 global $USER, $CFG;
22
f9903ed0 23 // Get all the possible users
24 $users = array();
720a43ce 25
26 if ($course->category) {
30d6173e 27 if ($courseusers = get_course_users($course->id, "u.lastaccess DESC")) {
28 foreach ($courseusers as $courseuser) {
29 $users[$courseuser->id] = "$courseuser->firstname $courseuser->lastname";
30 }
f9903ed0 31 }
9fa49e22 32 if ($guest = get_guest()) {
30d6173e 33 $users[$guest->id] = "$guest->firstname $guest->lastname";
122cffc9 34 }
f9903ed0 35 }
720a43ce 36
37 if (isadmin()) {
9fa49e22 38 if ($ccc = get_records("course", "", "", "fullname")) {
720a43ce 39 foreach ($ccc as $cc) {
cfa5d3f2 40 if ($cc->category) {
41 $courses["$cc->id"] = "$cc->fullname";
42 } else {
43 $courses["$cc->id"] = " $cc->fullname (Site)";
44 }
720a43ce 45 }
f9903ed0 46 }
cfa5d3f2 47 asort($courses);
f9903ed0 48 }
49
dcde9f02 50
51 $strftimedate = get_string("strftimedate");
52 $strftimedaydate = get_string("strftimedaydate");
53
f9903ed0 54 asort($users);
55
56 // Get all the possible dates
9481285b 57 // Note that we are keeping track of real (GMT) time and user time
58 // User time is only used in displays - all calcs and passing is GMT
59
60 $timenow = time(); // GMT
61
62 // What day is it now for the user, and when is midnight that day (in GMT).
9604ccb1 63 $timemidnight = $today = usergetmidnight($timenow);
9481285b 64
65 // Put today up the top of the list
dcde9f02 66 $dates = array("$timemidnight" => get_string("today").", ".userdate($timenow, $strftimedate) );
9481285b 67
68 if (! $course->startdate) {
69 $course->startdate = $course->timecreated;
70 }
f9903ed0 71
9481285b 72 $numdates = 1;
73 while ($timemidnight > $course->startdate and $numdates < 365) {
f9903ed0 74 $timemidnight = $timemidnight - 86400;
9481285b 75 $timenow = $timenow - 86400;
dcde9f02 76 $dates["$timemidnight"] = userdate($timenow, $strftimedaydate);
9481285b 77 $numdates++;
f9903ed0 78 }
79
80 if ($selecteddate == "today") {
81 $selecteddate = $today;
82 }
83
84 echo "<CENTER>";
85 echo "<FORM ACTION=log.php METHOD=get>";
720a43ce 86 if (isadmin()) {
849bc02a 87 choose_from_menu ($courses, "id", $course->id, "");
720a43ce 88 } else {
89 echo "<INPUT TYPE=hidden NAME=id VALUE=\"$course->id\">";
90 }
91 if ($course->category) {
97c270e9 92 choose_from_menu ($users, "user", $selecteduser, get_string("allparticipants") );
720a43ce 93 }
97c270e9 94 choose_from_menu ($dates, "date", $selecteddate, get_string("alldays"));
95 echo "<INPUT TYPE=submit VALUE=\"".get_string("showtheselogs")."\">";
f9903ed0 96 echo "</FORM>";
97 echo "</CENTER>";
98}
99
600149be 100function make_log_url($module, $url) {
101 switch ($module) {
102 case "course":
103 case "user":
104 case "file":
105 case "login":
106 case "lib":
107 case "admin":
108 return "/$module/$url";
109 break;
110 default:
111 return "/mod/$module/$url";
112 break;
113 }
114}
115
116
f9903ed0 117function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
9481285b 118// It is assumed that $date is the GMT time of midnight for that day,
119// and so the next 86400 seconds worth of logs are printed.
f9903ed0 120
3d891989 121 global $CFG;
47f1da80 122
720a43ce 123 if ($course->category) {
ebc3bd2b 124 $selector = "WHERE l.course='$course->id' AND l.userid = u.id";
a2ab3b05 125
720a43ce 126 } else {
ebc3bd2b 127 $selector = "WHERE l.userid = u.id"; // Show all courses
9fa49e22 128 if ($ccc = get_courses(-1)) {
720a43ce 129 foreach ($ccc as $cc) {
130 $courses[$cc->id] = "$cc->shortname";
131 }
132 }
133 }
f9903ed0 134
135 if ($user) {
ebc3bd2b 136 $selector .= " AND l.userid = '$user'";
f9903ed0 137 }
138
139 if ($date) {
140 $enddate = $date + 86400;
141 $selector .= " AND l.time > '$date' AND l.time < '$enddate'";
142 }
143
f9d5fd3b 144 $order = $order." LIMIT ".COURSE_MAX_LOGS_PER_PAGE; // To keep it manageable
145
6aeec7f8 146 if (!$logs = get_logs($selector, $order)) {
f9903ed0 147 notify("No logs found!");
148 print_footer($course);
149 exit;
150 }
151
152 $count=0;
153 $tt = getdate(time());
154 $today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
f9d5fd3b 155 if (($totalcountlogs = count($logs)) == COURSE_MAX_LOGS_PER_PAGE) {
156 $totalcountlogs = "$totalcountlogs (+)";
1c0200e0 157 }
158
dcde9f02 159 $strftimedatetime = get_string("strftimedatetime");
160
f9d5fd3b 161 echo "<p align=center>";
1c0200e0 162 print_string("displayingrecords", "", $totalcountlogs);
f9d5fd3b 163 echo "</p>";
1c0200e0 164
f9d5fd3b 165 echo "<table border=0 align=center cellpadding=3 cellspacing=3>";
f9903ed0 166 foreach ($logs as $log) {
600149be 167
9fa49e22 168 if ($ld = get_record("log_display", "module", "$log->module", "action", "$log->action")) {
565f7a95 169 $log->info = get_field($ld->mtable, $ld->field, "id", $log->info);
600149be 170 }
171
f9d5fd3b 172 echo "<tr nowrap>";
720a43ce 173 if (! $course->category) {
f9d5fd3b 174 echo "<td nowrap><font size=2><a href=\"view.php?id=$log->course\">".$courses[$log->course]."</a></td>";
720a43ce 175 }
f9d5fd3b 176 echo "<td nowrap align=right><font size=2>".userdate($log->time, "%a")."</td>";
177 echo "<td nowrap><font size=2>".userdate($log->time, $strftimedatetime)."</td>";
dc0dc7d5 178 echo "<td nowrap><font size=2>";
47f1da80 179 link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", "ipatlas","$log->ip", 400, 700);
f9d5fd3b 180 echo "</td>";
181 echo "<td nowrap><font size=2><a href=\"../user/view.php?id=$log->userid&course=$log->course\"><b>$log->firstname $log->lastname</b></td>";
182 echo "<td nowrap><font size=2>";
600149be 183 link_to_popup_window( make_log_url($log->module,$log->url), "fromloglive","$log->module $log->action", 400, 600);
f9d5fd3b 184 echo "</td>";
185 echo "<td nowrap><font size=2>$log->info</td>";
186 echo "</tr>";
f9903ed0 187 }
f9d5fd3b 188 echo "</table>";
f9903ed0 189}
190
191
776dc270 192function print_all_courses($category="all", $style="full", $maxcount=999, $width=180) {
dc0dc7d5 193 global $CFG, $THEME, $USER;
d887b5a7 194
ba2e5d73 195 if ($category == "all") {
9fa49e22 196 $courses = get_courses();
0a263205 197
198 } else if ($category == "my") {
199 if (isset($USER->id)) {
9fa49e22 200 if ($courses = get_courses()) {
0a263205 201 foreach ($courses as $key => $course) {
202 if (!isteacher($course->id) and !isstudent($course->id)) {
203 unset($courses[$key]);
204 }
205 }
206 }
207 }
208
ba2e5d73 209 } else {
9fa49e22 210 $courses = get_courses($category);
ba2e5d73 211 }
212
393cc508 213 if ($style == "minimal") {
214 $count = 0;
dc0dc7d5 215 if (empty($THEME->custompix)) {
216 $icon = "<img src=\"$CFG->wwwroot/pix/i/course.gif\" height=16 width=16 alt=\"".get_string("course")."\">";
217 } else {
218 $icon = "<img src=\"$CFG->wwwroot/theme/$CFG->theme/pix/i/course.gif\" height=16 width=16 alt=\"".get_string("course")."\">";
219 }
393cc508 220 if ($courses) {
94361e02 221 foreach ($courses as $course) {
dc0dc7d5 222 $moddata[]="<a title=\"$course->shortname\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
94361e02 223 $modicon[]=$icon;
224 if ($count++ >= $maxcount) {
225 break;
226 }
227 }
dc0dc7d5 228 $fulllist = "<p><a href=\"$CFG->wwwroot/course/\">".get_string("fulllistofcourses")."</a>...";
94361e02 229 } else {
393cc508 230 $moddata = array();
231 $modicon = array();
232 $fulllist = get_string("nocoursesyet");
233 }
234 print_side_block(get_string("courses"), "", $moddata, $modicon, $fulllist, $width);
235
236 } else if ($courses) {
237 foreach ($courses as $course) {
238 print_course($course);
dc0dc7d5 239 echo "<br />\n";
d887b5a7 240 }
241
242 } else {
dc0dc7d5 243 echo "<p>".get_string("nocoursesyet")."</p>";
d887b5a7 244 }
245}
246
247
f9903ed0 248function print_course($course) {
249
dc0dc7d5 250 global $CFG, $THEME;
d887b5a7 251
a83fded1 252 if (! $site = get_site()) {
f9903ed0 253 error("Could not find a site!");
254 }
255
dc0dc7d5 256 if (empty($THEME->custompix)) {
257 $pixpath = "$CFG->wwwroot/pix";
258 } else {
259 $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
260 }
261
d887b5a7 262 print_simple_box_start("CENTER", "100%");
f9903ed0 263
264 echo "<TABLE WIDTH=100%>";
da5c172a 265 echo "<TR VALIGN=top>";
266 echo "<TD VALIGN=top WIDTH=50%>";
7a302afc 267 echo "<P><FONT SIZE=3><B><A TITLE=\"".get_string("entercourse")."\"
9481285b 268 HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</A></B></FONT></P>";
0c71c9ae 269 if ($teachers = get_course_teachers($course->id)) {
f9903ed0 270 echo "<P><FONT SIZE=1>\n";
271 foreach ($teachers as $teacher) {
0c71c9ae 272 if ($teacher->authority > 0) {
b4d7002e 273 if (!$teacher->role) {
274 $teacher->role = $course->teacher;
275 }
276 echo "$teacher->role: <A HREF=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$teacher->firstname $teacher->lastname</A><BR>";
0c71c9ae 277 }
f9903ed0 278 }
279 echo "</FONT></P>";
da5c172a 280 }
f25f1e1b 281 if ($course->guest) {
5e367a2d 282 $strallowguests = get_string("allowguests");
283 echo "<A TITLE=\"$strallowguests\" HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
dc0dc7d5 284 echo "<IMG VSPACE=4 ALT=\"$strallowguests\" HEIGHT=16 WIDTH=16 BORDER=0 SRC=\"$pixpath/i/user.gif\"></A>&nbsp;&nbsp;";
da5c172a 285 }
286 if ($course->password) {
5e367a2d 287 $strrequireskey = get_string("requireskey");
288 echo "<A TITLE=\"$strrequireskey\" HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
dc0dc7d5 289 echo "<IMG VSPACE=4 ALT=\"$strrequireskey\" HEIGHT=16 WIDTH=16 BORDER=0 SRC=\"$pixpath/i/key.gif\"></A>";
da5c172a 290 }
291
292
293 echo "</TD><TD VALIGN=top WIDTH=50%>";
294 echo "<P><FONT SIZE=2>".text_to_html($course->summary)."</FONT></P>";
295 echo "</TD></TR>";
296 echo "</TABLE>";
f9903ed0 297
da5c172a 298 print_simple_box_end();
f9903ed0 299}
300
600149be 301function print_headline($text, $size=2) {
302 echo "<B><FONT SIZE=\"$size\">$text</FONT></B><BR>\n";
303}
304
305function print_recent_activity($course) {
306 // $course is an object
307 // This function trawls through the logs looking for
308 // anything new since the user's last login
309
3d891989 310 global $CFG, $USER;
600149be 311
312 if (! $USER->lastlogin ) {
3d891989 313 echo "<p align=center><font size=1>";
4b1371a7 314 print_string("welcometocourse", "", $course->shortname);
3d891989 315 echo "</font></p>";
600149be 316 return;
4c654ee3 317 } else {
3d891989 318 echo "<p align=center><font size=1>";
4c654ee3 319 echo get_string("yourlastlogin").":<BR>";
dcde9f02 320 echo userdate($USER->lastlogin, get_string("strftimerecentfull"));
3d891989 321 echo "</font></p>";
322 }
323
324 $timestart = $USER->lastlogin;
b1992e65 325 $timemaxrecent = time() - COURSE_MAX_RECENT_PERIOD;
326 if ($timestart < $timemaxrecent) {
327 $timestart = $timemaxrecent;
600149be 328 }
329
600149be 330
331 // Firstly, have there been any new enrolments?
332
333 $heading = false;
334 $content = false;
1b5910c4 335
336 $logs = get_records_select("log", "time > '$timestart' AND course = '$course->id' AND
337 module = 'course' AND action = 'enrol'", "time ASC");
338
339 if ($logs) {
340 foreach ($logs as $key => $log) {
600149be 341 if (! $heading) {
4c654ee3 342 print_headline(get_string("newusers").":");
600149be 343 $heading = true;
344 $content = true;
345 }
346 $user = get_record("user", "id", $log->info);
d578afc8 347 if (isstudent($course->id, $user->id)) {
3d891989 348 echo "<p><font size=1><a href=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</a></font></p>";
d578afc8 349 }
600149be 350 }
351 }
352
1b5910c4 353 // Next, have there been any modifications to the course structure?
354
355 $logs = get_records_select("log", "time > '$timestart' AND course = '$course->id' AND
356 module = 'course' AND action LIKE '% mod'", "time ASC");
357
358 if ($logs) {
359 foreach ($logs as $key => $log) {
360 $info = split(" ", $log->info);
361 $modname = get_field($info[0], "name", "id", $info[1]);
362 //Create a temp valid module structure (course,id)
363 $tempmod->course = $log->course;
364 $tempmod->id = $info[1];
365 //Obtain the visible property from the instance
366 $modvisible = instance_is_visible($info[0],$tempmod);
367
368 //Only if the mod is visible
369 if ($modvisible) {
370 switch ($log->action) {
371 case "add mod":
372 $stradded = get_string("added", "moodle", get_string("modulename", $info[0]));
373 $changelist["$log->info"] = array ("operation" => "add", "text" => "$stradded:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
374 break;
375 case "update mod":
376 $strupdated = get_string("updated", "moodle", get_string("modulename", $info[0]));
377 if (empty($changelist["$log->info"])) {
378 $changelist["$log->info"] = array ("operation" => "update", "text" => "$strupdated:<BR><A HREF=\"$CFG->wwwroot/course/$log->url\">$modname</A>");
379 }
380 break;
381 case "delete mod":
382 if (!empty($changelist["$log->info"]["operation"]) and
383 $changelist["$log->info"]["operation"] == "add") {
384 $changelist["$log->info"] = NULL;
385 } else {
386 $strdeleted = get_string("deletedactivity", "moodle", get_string("modulename", $info[0]));
387 $changelist["$log->info"] = array ("operation" => "delete", "text" => $strdeleted);
388 }
389 break;
600149be 390 }
ef25340c 391 }
392 }
393 }
394
9c9f7d77 395 if (!empty($changelist)) {
ef25340c 396 foreach ($changelist as $changeinfo => $change) {
397 if ($change) {
398 $changes[$changeinfo] = $change;
399 }
400 }
401 if (count($changes) > 0) {
4c654ee3 402 print_headline(get_string("courseupdates").":");
ef25340c 403 $content = true;
404 foreach ($changes as $changeinfo => $change) {
3d891989 405 echo "<p><font size=1>".$change["text"]."</font></p>";
600149be 406 }
407 }
408 }
409
3869a2ac 410 // Now display new things from each module
600149be 411
3869a2ac 412 $mods = get_list_of_plugins("mod");
600149be 413
1b5910c4 414 $isteacher = isteacher($course->id);
415
416 foreach ($mods as $mod) { // Each module gets it's own logs and prints them
3869a2ac 417 include_once("$CFG->dirroot/mod/$mod/lib.php");
418 $print_recent_activity = $mod."_print_recent_activity";
1b5910c4 419 if (function_exists($print_recent_activity)) {
420 $modcontent = $print_recent_activity($course, $isteacher, $timestart);
3869a2ac 421 if ($modcontent) {
422 $content = true;
600149be 423 }
600149be 424 }
425 }
426
427 if (! $content) {
3d891989 428 echo "<font size=2>".get_string("nothingnew")."</font>";
600149be 429 }
600149be 430}
431
e1360728 432
d897cae4 433function get_array_of_activities($courseid) {
434// For a given course, returns an array of course activity objects
435// Each item in the array contains he following properties:
436// cm - course module id
437// mod - name of the module (eg forum)
438// section - the number of the section (eg week or topic)
439// name - the name of the instance
fec5a6a6 440// visible - when the instance is visible or no
d897cae4 441
442 $mod = array();
443
9fa49e22 444 if (!$rawmods = get_course_mods($courseid)) {
d897cae4 445 return NULL;
446 }
447
448 if ($sections = get_records("course_sections", "course", $courseid, "section ASC")) {
449 foreach ($sections as $section) {
74666583 450 if (!empty($section->sequence)) {
d897cae4 451 $sequence = explode(",", $section->sequence);
452 foreach ($sequence as $seq) {
7af6281f 453 if (empty($rawmods[$seq])) {
454 continue;
455 }
d897cae4 456 $mod[$seq]->cm = $rawmods[$seq]->id;
457 $mod[$seq]->mod = $rawmods[$seq]->modname;
458 $mod[$seq]->section = $section->section;
459 $mod[$seq]->name = urlencode(get_field($rawmods[$seq]->modname, "name", "id", $rawmods[$seq]->instance));
fec5a6a6 460 $mod[$seq]->visible = $rawmods[$seq]->visible;
d897cae4 461 }
462 }
463 }
464 }
465 return $mod;
466}
467
468
469
e1360728 470
90845098 471function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modnamesused) {
472// Returns a number of useful structures for course displays
7468bf01 473
90845098 474 $mods = NULL; // course modules indexed by id
475 $modnames = NULL; // all course module names
94361e02 476 $modnamesplural= NULL; // all course module names (plural form)
90845098 477 $modnamesused = NULL; // course module names used
7468bf01 478
9fa49e22 479 if ($allmods = get_records("modules")) {
90845098 480 foreach ($allmods as $mod) {
481 $modnames[$mod->name] = get_string("modulename", "$mod->name");
482 $modnamesplural[$mod->name] = get_string("modulenameplural", "$mod->name");
483 }
484 asort($modnames);
485 } else {
486 error("No modules are installed!");
487 }
488
9fa49e22 489 if ($rawmods = get_course_mods($courseid)) {
7468bf01 490 foreach($rawmods as $mod) { // Index the mods
491 $mods[$mod->id] = $mod;
90845098 492 $mods[$mod->id]->modfullname = $modnames[$mod->modname];
1acfbce5 493 if ($mod->visible or isteacher($courseid)) {
494 $modnamesused[$mod->modname] = $modnames[$mod->modname];
495 }
7468bf01 496 }
c7da6f7a 497 if ($modnamesused) {
498 asort($modnamesused);
499 }
7468bf01 500 }
7468bf01 501}
502
9fa49e22 503
7468bf01 504function get_all_sections($courseid) {
505
d26d7ed0 506 return get_records("course_sections", "course", "$courseid", "section",
9fa49e22 507 "section, id, course, summary, sequence");
7468bf01 508}
509
b86fc0e2 510function course_set_display($courseid, $display=0) {
511 global $USER;
512
513 if (empty($USER)) {
514 return false;
515 }
516
517 if ($display == "all" or empty($display)) {
518 $display = 0;
519 }
520
521 if (record_exists("course_display", "userid", $USER->id, "course", $courseid)) {
522 set_field("course_display", "display", $display, "userid", $USER->id, "course", $courseid);
523 } else {
524 $record->userid = $USER->id;
525 $record->course = $courseid;
526 $record->display = $display;
527 if (!insert_record("course_display", $record)) {
528 notify("Could not save your course display!");
529 }
530 }
531
532 return $USER->display[$courseid] = $display; // Note: = not ==
533}
534
535function course_section_visible($courseid, $section) {
536/// Returns true/false depending on section visibility
537/// Can be expanded in the future to handle more complex
538/// course displays
539
540 global $USER;
541
542 if (empty($USER->display[$courseid])) {
543 return true;
544 }
545
546 return $USER->display[$courseid] == $section;
547}
548
ba2e5d73 549
5e367a2d 550function print_section_block($heading, $course, $section, $mods, $modnames, $modnamesused,
551 $absolute=true, $width="100%", $isediting=false) {
552
553 global $CFG;
554
555 $modinfo = unserialize($course->modinfo);
556 $moddata = array();
557 $modicon = array();
558 $editbuttons = "";
559
74666583 560 if (!empty($section->sequence)) {
5e367a2d 561
562 $sectionmods = explode(",", $section->sequence);
563
564 foreach ($sectionmods as $modnumber) {
565 $mod = $mods[$modnumber];
566 if ($isediting) {
1acfbce5 567 $editbuttons = make_editing_buttons($mod->id, $absolute, $mod->visible);
568 }
569 if ($mod->visible or isteacher($course->id)) {
570 $instancename = urldecode($modinfo[$modnumber]->name);
571 if ($mod->visible) {
572 $link_css = "";
573 } else {
574 $link_css = " class=\"dimmed\" ";
575 }
576 $modicon[] = "<img src=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" height=\"16\" width=\"16\" alt=\"$mod->modfullname\">";
577 $moddata[] = "<a title=\"$mod->modfullname\" $link_css href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</a><BR>$editbuttons";
5e367a2d 578 }
5e367a2d 579 }
580 }
a44d18e7 581 if ($isediting) {
15ac9065 582 $editmenu = popup_form("$CFG->wwwroot/course/mod.php?id=$course->id&amp;section=$section->section&add=",
5e367a2d 583 $modnames, "section0", "", get_string("add")."...", "mods", get_string("activities"), true);
584 $editmenu = "<DIV ALIGN=right>$editmenu</DIV>";
47f1da80 585 } else {
586 $editmenu = "";
5e367a2d 587 }
588
589 print_side_block($heading, "", $moddata, $modicon, $editmenu, $width);
590}
591
592
d897cae4 593function print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%") {
94361e02 594 global $CFG;
595
c408b0c4 596 $modinfo = unserialize($course->modinfo);
94361e02 597
19a55d67 598 echo "<TABLE WIDTH=\"$width\"><TR><TD>\n";
74666583 599 if (!empty($section->sequence)) {
94361e02 600
601 $sectionmods = explode(",", $section->sequence);
602
603 foreach ($sectionmods as $modnumber) {
9ae687af 604 if (empty($mods[$modnumber])) {
605 continue;
606 }
94361e02 607 $mod = $mods[$modnumber];
1acfbce5 608 if ($mod->visible or isteacher($course->id)) {
609 $instancename = urldecode($modinfo[$modnumber]->name);
610 if ($mod->visible) {
611 $link_css = "";
612 } else {
613 $link_css = " class=\"dimmed\" ";
614 }
615 echo "<IMG SRC=\"$CFG->wwwroot/mod/$mod->modname/icon.gif\" HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">";
616 echo " <FONT SIZE=2><A TITLE=\"$mod->modfullname\" $link_css";
617 echo " HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">$instancename</A></FONT>";
618 }
d897cae4 619 if (isediting($course->id)) {
5e367a2d 620 echo "&nbsp;&nbsp;";
1acfbce5 621 echo make_editing_buttons($mod->id, $absolute, $mod->visible);
622 }
623 if ($mod->visible or isteacher($course->id)) {
624 echo "<BR>\n";
94361e02 625 }
94361e02 626 }
627 }
47ef8795 628 echo "</TD></TR></TABLE><BR>\n\n";
a7ad3ea6 629}
630
7541bc3e 631function print_heading_block($heading, $width="100%", $class="headingblock") {
5e367a2d 632 global $THEME;
633
7541bc3e 634 echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
635 echo "<tr><td bgcolor=\"$THEME->cellheading\" class=\"$class\">";
5e367a2d 636 echo stripslashes($heading);
637 echo "</td></tr></table>";
5e367a2d 638}
639
640function print_side_block($heading="", $content="", $list=NULL, $icons=NULL, $footer="", $width=180) {
641// Prints a nice side block with an optional header. The content can either
642// be a block of HTML or a list of text with optional icons.
a7ad3ea6 643
5e367a2d 644 global $THEME;
645
7541bc3e 646 print_side_block_start($heading, $width);
647
5e367a2d 648 if ($content) {
7541bc3e 649 echo "$content";
5e367a2d 650 } else {
5e367a2d 651 echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">";
652 foreach ($list as $key => $string) {
7541bc3e 653 echo "<tr bgcolor=\"$THEME->cellcontent2\">";
5e367a2d 654 if ($icons) {
7541bc3e 655 echo "<td class=\"sideblocklinks\" valign=\"top\" width=\"16\">".$icons[$key]."</td>";
a7ad3ea6 656 }
7541bc3e 657 echo "<td class=\"sideblocklinks\" valign=\"top\" width=\"*\"><font size=\"-1\">$string</font></td>";
5e367a2d 658 echo "</tr>";
a7ad3ea6 659 }
5e367a2d 660 if ($footer) {
7541bc3e 661 echo "<tr bgcolor=\"$THEME->cellcontent2\">";
5e367a2d 662 if ($icons) {
7541bc3e 663 echo "<td class=\"sideblocklinks\" valign=\"top\" width=\"16\">&nbsp;</td>";
5e367a2d 664 }
7541bc3e 665 echo "<td class=\"sideblocklinks\"><font size=\"-1\">$footer</td>";
5e367a2d 666 echo "</tr>";
667 }
668 echo "</table>";
a7ad3ea6 669 }
5e367a2d 670
7541bc3e 671 print_side_block_end();
672}
673
674function print_side_block_start($heading="", $width=180, $class="sideblockmain") {
675// Starts a nice side block with an optional header.
676
677 global $THEME;
678
679 echo "<table class=\"sideblock\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">";
680 if ($heading) {
681 echo "<tr>";
682 echo "<td class=\"sideblockheading\" bgcolor=\"$THEME->cellheading\">$heading</td>";
683 echo "</tr>";
684 }
685 echo "<tr>";
686 echo "<td class=\"$class\" bgcolor=\"$THEME->cellcontent2\">";
687}
688
689function print_side_block_end() {
690 echo "</td></tr>";
5e367a2d 691 echo "</table><br \>";
94361e02 692}
693
5e367a2d 694
670fddf1 695function print_admin_links ($siteid, $width=180) {
dc0dc7d5 696 global $CFG, $THEME;
2b25f2a0 697
dc0dc7d5 698 if (empty($THEME->custompix)) {
699 $icon = "<img src=\"$CFG->wwwroot/pix/i/settings.gif\" height=16 width=16 alt=\"\">";
700 } else {
701 $icon = "<img src=\"$CFG->wwwroot/theme/$CFG->theme/pix/i/settings.gif\" height=16 width=16 alt=\"\">";
702 }
703
1924074c 704 if (isadmin()) {
dae73c05 705 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/config.php\">".get_string("configvariables")."</A>";
1924074c 706 $modicon[]=$icon;
dae73c05 707 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/site.php\">".get_string("sitesettings")."</A>";
1924074c 708 $modicon[]=$icon;
709 $moddata[]="<A HREF=\"$CFG->wwwroot/course/log.php?id=$siteid\">".get_string("sitelogs")."</A>";
710 $modicon[]=$icon;
711 $moddata[]="<A HREF=\"$CFG->wwwroot/theme/index.php\">".get_string("choosetheme")."</A>";
712 $modicon[]=$icon;
dae73c05 713 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/lang.php\">".get_string("checklanguage")."</A>";
1924074c 714 $modicon[]=$icon;
be09831a 715 if (file_exists("$CFG->dirroot/$CFG->admin/$CFG->dbtype")) {
dae73c05 716 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/$CFG->dbtype/frame.php\">".get_string("managedatabase")."</A>";
1924074c 717 $modicon[]=$icon;
718 }
719 $moddata[]="<HR>";
720 $modicon[]="";
721 }
722 if (iscreator()) {
723 $moddata[]="<A HREF=\"$CFG->wwwroot/course/edit.php\">".get_string("addnewcourse")."</A>";
724 $modicon[]=$icon;
725 $moddata[]="<A HREF=\"$CFG->wwwroot/course/teacher.php\">".get_string("assignteachers")."</A>";
726 $modicon[]=$icon;
5b337cdf 727 $fulladmin = "";
1924074c 728 }
729 if (isadmin()) {
730 $moddata[]="<A HREF=\"$CFG->wwwroot/course/categories.php\">".get_string("categories")."</A>";
731 $modicon[]=$icon;
732 $moddata[]="<A HREF=\"$CFG->wwwroot/course/delete.php\">".get_string("deletecourse")."</A>";
733 $modicon[]=$icon;
734 $moddata[]="<HR>";
735 $modicon[]="";
3399a22c 736 if($CFG->auth == "email" || $CFG->auth == "none" || $CFG->auth == "manual"){
737 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true\">".get_string("addnewuser")."</A>";
738 $modicon[]=$icon;
739 }
dae73c05 740 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/user.php\">".get_string("edituser")."</A>";
1924074c 741 $modicon[]=$icon;
dae73c05 742 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/admin.php\">".get_string("assignadmins")."</A>";
1924074c 743 $modicon[]=$icon;
dae73c05 744 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/creators.php\">".get_string("assigncreators")."</A>";
1924074c 745 $modicon[]=$icon;
dae73c05 746 $moddata[]="<A HREF=\"$CFG->wwwroot/$CFG->admin/auth.php\">".get_string("authentication")."</A>";
1924074c 747 $modicon[]=$icon;
dae73c05 748 $fulladmin = "<P><A HREF=\"$CFG->wwwroot/$CFG->admin/\">".get_string("admin")."</A>...";
1924074c 749 }
5e367a2d 750
751 print_side_block(get_string("administration"), "", $moddata, $modicon, $fulladmin, $width);
752
dc0dc7d5 753 echo "<img src=\"$CFG->wwwroot/pix/spacer.gif\" width=\"$width\" height=1><br>";
2b25f2a0 754}
755
b4d7002e 756function print_course_admin_links($course, $width=180) {
dc0dc7d5 757 global $USER, $CFG, $THEME;
44dad735 758
dc0dc7d5 759 if (empty($THEME->custompix)) {
760 $pixpath = "$CFG->wwwroot/pix";
761 $modpixpath = "$CFG->wwwroot/mod";
762 } else {
763 $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
764 $modpixpath = "$CFG->wwwroot/theme/$CFG->theme/pix/mod";
765 }
13469b82 766 if (isteacher($course->id)) {
dc0dc7d5 767 $adminicon[]="<img src=\"$pixpath/i/edit.gif\" height=16 width=16 alt=\"\">";
13469b82 768 if (isediting($course->id)) {
dc0dc7d5 769 $admindata[]="<a href=\"view.php?id=$course->id&edit=off\">".get_string("turneditingoff")."</a>";
13469b82 770 } else {
dc0dc7d5 771 $admindata[]="<a href=\"view.php?id=$course->id&edit=on\">".get_string("turneditingon")."</a>";
13469b82 772 }
dc0dc7d5 773 $admindata[]="<a href=\"edit.php?id=$course->id\">".get_string("settings")."...</a>";
774 $adminicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
13469b82 775 if (!$course->teachers) {
776 $course->teachers = get_string("defaultcourseteachers");
777 }
dc0dc7d5 778 $admindata[]="<a href=\"teachers.php?id=$course->id\">$course->teachers...</a>";
779 $adminicon[]="<img src=\"$pixpath/i/settings.gif\" height=16 width=16 alt=\"\">";
13469b82 780
dc0dc7d5 781 $admindata[]="<a href=\"grades.php?id=$course->id\">".get_string("grades")."...</a>";
782 $adminicon[]="<img src=\"$pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
13469b82 783
dc0dc7d5 784 $admindata[]="<a href=\"log.php?id=$course->id\">".get_string("logs")."...</a>";
785 $adminicon[]="<img src=\"$pixpath/i/log.gif\" height=16 width=16 alt=\"\">";
786
787 $admindata[]="<a href=\"$CFG->wwwroot/files/index.php?id=$course->id\">".get_string("files")."...</a>";
788 $adminicon[]="<img src=\"$pixpath/i/files.gif\" height=16 width=16 alt=\"\">";
13469b82 789
dc0dc7d5 790 $admindata[]="<a href=\"$CFG->wwwroot/doc/view.php?id=$course->id&file=teacher.html\">".get_string("help")."...</a>";
791 $adminicon[]="<img src=\"$modpixpath/resource/icon.gif\" height=16 width=16 alt=\"\">";
b4d7002e 792
13469b82 793 if ($teacherforum = forum_get_course_forum($course->id, "teacher")) {
dc0dc7d5 794 $admindata[]="<a href=\"$CFG->wwwroot/mod/forum/view.php?f=$teacherforum->id\">".get_string("nameteacher", "forum")."</a>";
795 $adminicon[]="<img src=\"$modpixpath/forum/icon.gif\" height=16 width=16 alt=\"\">";
13469b82 796 }
797 } else {
dc0dc7d5 798 $admindata[]="<a href=\"grade.php?id=$course->id\">".get_string("grades")."...</a>";
799 $adminicon[]="<img src=\"$pixpath/i/grades.gif\" height=16 width=16 alt=\"\">";
13469b82 800 }
44dad735 801
5e367a2d 802 print_side_block(get_string("administration"), "", $admindata, $adminicon, "", $width);
44dad735 803}
2b25f2a0 804
ba2e5d73 805function print_course_categories($categories, $selected="none", $width=180) {
0a263205 806 global $CFG, $THEME, $USER;
85098089 807
808 $strallowguests = get_string("allowguests");
809 $strrequireskey = get_string("requireskey");
ba2e5d73 810
dc0dc7d5 811 if (empty($THEME->custompix)) {
812 $pixpath = "$CFG->wwwroot/pix";
813 } else {
814 $pixpath = "$CFG->wwwroot/theme/$CFG->theme/pix";
815 }
816
0c656181 817 if ($selected == "index") { // Print comprehensive index of categories with courses
9fa49e22 818 if ($courses = get_courses()) {
0c656181 819 if (isset($USER->id) and !isadmin()) {
39246b72 820 print_simple_box_start("CENTER", "100%", $THEME->cellheading);
dc0dc7d5 821 print_heading("<a href=\"course/index.php?category=my\">".get_string("mycourses")."</a>", "left");
0c656181 822 $some = false;
dc0dc7d5 823 echo "<ul>";
0c656181 824 foreach ($courses as $key => $course) {
825 if (isteacher($course->id) or isstudent($course->id)) {
dc0dc7d5 826 echo "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
827 echo "<br />";
0c656181 828 $some = true;
829 }
830 }
831 if (!$some) {
832 print_string("nocoursesyet");
833 }
dc0dc7d5 834 echo "</ul>";
0c656181 835 print_simple_box_end();
836 print_spacer(8,1);
837 }
838 foreach ($categories as $category) {
bd4707bf 839 print_simple_box_start("CENTER", "100%");
dc0dc7d5 840 print_heading("<a href=\"course/index.php?category=$category->id\">$category->name</a>", "left");
0c656181 841 $some = false;
dc0dc7d5 842 echo "<ul>";
0c656181 843 foreach ($courses as $key => $course) {
844 if ($course->category == $category->id) {
dc0dc7d5 845 echo "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
85098089 846 echo "&nbsp;&nbsp;";
0c656181 847 unset($courses[$key]);
85098089 848 if ($course->guest ) {
dc0dc7d5 849 echo "<a title=\"$strallowguests\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
850 echo "<img alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/user.gif\"></a>";
85098089 851 }
852 if ($course->password) {
dc0dc7d5 853 echo "<a title=\"$strrequireskey\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">";
854 echo "<img alt=\"\" height=16 width=16 border=0 src=\"$pixpath/i/key.gif\"></a>";
85098089 855 }
dc0dc7d5 856 echo "<br />";
0c656181 857 $some = true;
858 }
859 }
860 if (!$some) {
861 print_string("nocoursesyet");
862 }
dc0dc7d5 863 echo "</ul>";
0c656181 864 print_simple_box_end();
865 print_spacer(8,1);
866 }
ba2e5d73 867 }
0c656181 868
869 } else { // Print short list of categories only
870 foreach ($categories as $cat) {
dc0dc7d5 871 $caticon[]="<img src=\"$pixpath/i/course.gif\" height=16 width=16>";
0c656181 872 if ($cat->id == $selected) {
873 $catdata[]="$cat->name";
874 } else {
dc0dc7d5 875 $catdata[]="<a href=\"$CFG->wwwroot/course/index.php?category=$cat->id\">$cat->name</a>";
0c656181 876 }
877 }
dc0dc7d5 878 $catdata[] = "<a href=\"$CFG->wwwroot/course/index.php?category=all\">".get_string("fulllistofcourses")."</a>";
13770d0c 879 $caticon[] = "";
0c656181 880 if (isset($USER->id)) {
dc0dc7d5 881 $catdata[] = "<a href=\"$CFG->wwwroot/course/index.php?category=my\">".get_string("mycourses")."</a>";
13770d0c 882 $caticon[] = "";
0c656181 883 }
13770d0c 884 print_side_block(get_string("categories"), "", $catdata, $caticon, "", $width);
ba2e5d73 885 }
ba2e5d73 886}
94361e02 887
2b8cef80 888function print_log_graph($course, $userid=0, $type="course.png", $date=0) {
889 global $CFG;
607809b3 890 if (empty($CFG->gdversion)) {
891 echo "(".get_string("gdneed").")";
892 } else {
893 echo "<IMG BORDER=0 SRC=\"$CFG->wwwroot/course/loggraph.php?id=$course->id&user=$userid&type=$type&date=$date\">";
894 }
2b8cef80 895}
896
11b0c469 897
898
899/// MODULE FUNCTIONS /////////////////////////////////////////////////////////////////
900
901function add_course_module($mod) {
902 GLOBAL $db;
903
e5dfd0f3 904 $mod->added = time();
11b0c469 905
e5dfd0f3 906 return insert_record("course_modules", $mod);
11b0c469 907}
908
909function add_mod_to_section($mod) {
910// Returns the course_sections ID where the mod is inserted
911 GLOBAL $db;
912
9fa49e22 913 if ($section = get_record("course_sections", "course", "$mod->course", "section", "$mod->section")) {
74666583 914 if (!empty($section->sequence)) {
e5dfd0f3 915 $newsequence = "$section->sequence,$mod->coursemodule";
11b0c469 916 } else {
917 $newsequence = "$mod->coursemodule";
918 }
e5dfd0f3 919 if (set_field("course_sections", "sequence", $newsequence, "id", $section->id)) {
920 return $section->id; // Return course_sections ID that was used.
11b0c469 921 } else {
e5dfd0f3 922 return 0;
11b0c469 923 }
924
925 } else { // Insert a new record
e5dfd0f3 926 $section->course = $mod->course;
927 $section->section = $mod->section;
928 $section->summary = "";
929 $section->sequence = $mod->coursemodule;
930 return insert_record("course_sections", $section);
11b0c469 931 }
932}
933
1acfbce5 934function hide_course_module($mod) {
935 return set_field("course_modules", "visible", 0, "id", $mod);
936}
937
938function show_course_module($mod) {
939 return set_field("course_modules", "visible", 1, "id", $mod);
940}
941
11b0c469 942function delete_course_module($mod) {
943 return set_field("course_modules", "deleted", 1, "id", $mod);
944}
945
946function delete_mod_from_section($mod, $section) {
947 GLOBAL $db;
948
e5dfd0f3 949 if ($section = get_record("course_sections", "id", "$section") ) {
11b0c469 950
e5dfd0f3 951 $modarray = explode(",", $section->sequence);
11b0c469 952
953 if ($key = array_keys ($modarray, $mod)) {
954 array_splice($modarray, $key[0], 1);
955 $newsequence = implode(",", $modarray);
e5dfd0f3 956 return set_field("course_sections", "sequence", $newsequence, "id", $section->id);
11b0c469 957 } else {
958 return false;
959 }
960
961 } else {
962 return false;
963 }
964}
965
966
7c0f2984 967function move_module($cm, $move) {
11b0c469 968 GLOBAL $db;
969
970 if (!$move) {
971 return true;
972 }
973
11b0c469 974 if (! $thissection = get_record("course_sections", "id", $cm->section)) {
975 error("This course section doesn't exist");
976 }
977
978 $mods = explode(",", $thissection->sequence);
979
980 $len = count($mods);
981 $pos = array_keys($mods, $cm->id);
982 $thepos = $pos[0];
983
984 if ($len == 0 || count($pos) == 0 ) {
985 error("Very strange. Could not find the required module in this section.");
986 }
987
988 if ($len == 1) {
989 $first = true;
990 $last = true;
991 } else {
992 $first = ($thepos == 0);
993 $last = ($thepos == $len - 1);
994 }
995
996 if ($move < 0) { // Moving the module up
997
998 if ($first) {
999 if ($thissection->section == 1) { // First section, do nothing
1000 return true;
1001 } else { // Push onto end of previous section
1002 $prevsectionnumber = $thissection->section - 1;
9fa49e22 1003 if (! $prevsection = get_record("course_sections", "course", "$thissection->course",
1004 "section", "$prevsectionnumber")) {
11b0c469 1005 error("Previous section ($prevsection->id) doesn't exist");
1006 }
1007
74666583 1008 if (!empty($prevsection->sequence)) {
11b0c469 1009 $newsequence = "$prevsection->sequence,$cm->id";
1010 } else {
1011 $newsequence = "$cm->id";
1012 }
1013
1014 if (! set_field("course_sections", "sequence", $newsequence, "id", $prevsection->id)) {
1015 error("Previous section could not be updated");
1016 }
1017
1018 if (! set_field("course_modules", "section", $prevsection->id, "id", $cm->id)) {
1019 error("Module could not be updated");
1020 }
1021
1022 array_splice($mods, 0, 1);
1023 $newsequence = implode(",", $mods);
1024 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1025 error("Module could not be updated");
1026 }
1027
1028 return true;
1029
1030 }
1031 } else { // move up within this section
1032 $swap = $mods[$thepos-1];
1033 $mods[$thepos-1] = $mods[$thepos];
1034 $mods[$thepos] = $swap;
1035
1036 $newsequence = implode(",", $mods);
1037 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1038 error("This section could not be updated");
1039 }
1040 return true;
1041 }
1042
1043 } else { // Moving the module down
1044
1045 if ($last) {
1046 $nextsectionnumber = $thissection->section + 1;
9fa49e22 1047 if ($nextsection = get_record("course_sections", "course", "$thissection->course",
1048 "section", "$nextsectionnumber")) {
11b0c469 1049
74666583 1050 if (!empty($nextsection->sequence)) {
11b0c469 1051 $newsequence = "$cm->id,$nextsection->sequence";
1052 } else {
1053 $newsequence = "$cm->id";
1054 }
1055
1056 if (! set_field("course_sections", "sequence", $newsequence, "id", $nextsection->id)) {
1057 error("Next section could not be updated");
1058 }
1059
1060 if (! set_field("course_modules", "section", $nextsection->id, "id", $cm->id)) {
1061 error("Module could not be updated");
1062 }
1063
1064 array_splice($mods, $thepos, 1);
1065 $newsequence = implode(",", $mods);
1066 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1067 error("This section could not be updated");
1068 }
1069 return true;
1070
1071 } else { // There is no next section, so just return
1072 return true;
1073
1074 }
1075 } else { // move down within this section
1076 $swap = $mods[$thepos+1];
1077 $mods[$thepos+1] = $mods[$thepos];
1078 $mods[$thepos] = $swap;
1079
1080 $newsequence = implode(",", $mods);
1081 if (! set_field("course_sections", "sequence", $newsequence, "id", $thissection->id)) {
1082 error("This section could not be updated");
1083 }
1084 return true;
1085 }
1086 }
1087}
1088
1acfbce5 1089function make_editing_buttons($moduleid, $absolute=false, $visible=true, $str=NULL) {
dc0dc7d5 1090 global $CFG, $THEME;
94361e02 1091
1acfbce5 1092 if (empty($str)) {
1093 $str->delete = get_string("delete");
1094 $str->moveup = get_string("moveup");
1095 $str->movedown = get_string("movedown");
1096 $str->update = get_string("update");
1097 $str->hide = get_string("hide");
1098 $str->show = get_string("show");
1099 }
94361e02 1100
1101 if ($absolute) {
dc0dc7d5 1102 $path = "$CFG->wwwroot/course";
1103 } else {
1104 $path = ".";
1105 }
1106
1107 if (empty($THEME->custompix)) {
1108 $pixpath = "$path/../pix";
94361e02 1109 } else {
dc0dc7d5 1110 $pixpath = "$path/../theme/$CFG->theme/pix";
94361e02 1111 }
1acfbce5 1112
1113 if ($visible) {
dc0dc7d5 1114 $hideshow = " <a title=\"$str->hide\" href=\"$path/mod.php?hide=$moduleid\"><img
1115 src=\"$pixpath/t/hide.gif\" height=11 width=11 border=0></a>";
1acfbce5 1116 } else {
dc0dc7d5 1117 $hideshow = " <a title=\"$str->show\" href=\"$path/mod.php?show=$moduleid\"><img
1118 src=\"$pixpath/t/show.gif\" height=11 width=11 border=0></a>";
1acfbce5 1119 }
1120
dc0dc7d5 1121 return "<a title=\"$str->delete\" href=\"$path/mod.php?delete=$moduleid\"><img
1122 src=\"$pixpath/t/delete.gif\" height=11 width=11 border=0></a>
1123 <a title=\"$str->moveup\" href=\"$path/mod.php?id=$moduleid&move=-1\"><img
1124 src=\"$pixpath/t/up.gif\" height=11 width=11 border=0></a>
1125 <a title=\"$str->movedown\" href=\"$path/mod.php?id=$moduleid&move=1\"><img
1126 src=\"$pixpath/t/down.gif\" height=11 width=11 border=0></a>
1127 <a title=\"$str->update\" href=\"$path/mod.php?update=$moduleid\"><img
1128 src=\"$pixpath/t/edit.gif\" height=11 width=11 border=0></a> $hideshow";
90845098 1129}
1130
f9903ed0 1131?>