3 # this plugin appends the list of uploaded attachments at the bottom of
4 # each page, the downloads / attachments plugin must be loaded too
6 # you could alternatively define EWIKI_AUTOVIEW to 0, and call the
7 # ewiki_attachments() wrapper function anywhere on yoursite.php
10 if (!defined("EWIKI_AUTOVIEW") ||
!EWIKI_AUTOVIEW
) {
11 $ewiki_plugins["view_append"][] = "ewiki_view_append_attachments";
15 $ewiki_t["en"]["ATTACHMENTS"] = "attachments";
16 $ewiki_t["de"]["ATTACHMENTS"] = "Anhänge";
20 function ewiki_view_append_attachments($id, $data, $action) {
22 $o = '<hr /><h4><a href="' . ewiki_script(EWIKI_ACTION_ATTACHMENTS
, $id) .
23 '">' . ewiki_t("ATTACHMENTS") . '</a></h4>';
25 $scan = 's:7:"section";' . serialize($id);
26 $result = ewiki_database("SEARCH", array("meta" => $scan));
28 #### BEGIN MOODLE CHANGES - show attachments link only if there are attachments.
29 #### - don't show the attachments on the content page.
30 if (count($result->entries
) <= 0) {
34 // while ($row = $result->get()) {
35 // $ord[$row["id"]] = $row["created"];
39 // foreach ($ord as $id => $uu) {
40 // $row = ewiki_database("GET", array("id"=>$id));
41 // if (EWIKI_PROTECTED_MODE && EWIKI_PROTECTED_MODE_HIDING && !ewiki_auth($row["id"], $row, "view")) {
44 // $o .= ewiki_entry_downloads($row, "*");
46 #### END MOODLE CHANGES
54 function ewiki_attachments() {
55 global $ewiki_title, $ewiki_id;
56 return(ewiki_view_append_attachments($ewiki_title, array("id"=>$ewiki_id), "view"));