define("PLAINTEXT", "4");
define("WEBLINK", "5");
define("HTML", "6");
+define("PROGRAM", "7");
$RESOURCE_TYPE = array (REFERENCE => get_string("resourcetype1", "resource"),
WEBPAGE => get_string("resourcetype2", "resource"),
UPLOADEDFILE => get_string("resourcetype3", "resource"),
PLAINTEXT => get_string("resourcetype4", "resource"),
WEBLINK => get_string("resourcetype5", "resource"),
- HTML => get_string("resourcetype6", "resource") );
+ HTML => get_string("resourcetype6", "resource"),
+ PROGRAM => get_string("resourcetype7", "resource") );
function resource_list_all_resources($courseid=0, $sort="name ASC", $recent=0) {
// Returns list of all resource links in an array of strings
print_footer($course);
break;
+ case PROGRAM: // Code provided by Mark Kimes <hectorp@buckfoodsvc.com>
+ add_to_log($course->id, "resource", "view", "view.php?id=$cm->id", "$resource->id");
+
+ $temptime = gmdate("YmdHis",time());
+
+ $temproot = $CFG->wwwroot . "/mod/resource/";
+
+ // I tried to get around this. I really did. But here we
+ // are, redefining the navigation resources specifically anyway.
+ // On the plus side, you can change the format of the navigation
+ // strings above without worrying what it'll do to this code. On
+ // the negative side, you'll have to update this code if you
+ // change the structure of the navigation completely. Bonus
+ // is that now we can have a chain of cooperative sites, each
+ // adding to the navigation string as it moves down the line,
+ // which could be quite cool. -- Mark
+
+ if ($course->category) {
+ $tempref = "<$course->shortname><" . $temproot . "../../course/view.php?id=$course->id>" .
+ "<$strresources><" . $temproot . "index.php?id=$course->id>";
+ } else {
+ $tempref = "<$strresources><index.php?id=$course->id>";
+ }
+
+ $tempurl = trim($resource->reference);
+
+ if ($tempquerystring = strstr($tempurl,'?')) {
+ $tempquerystring = substr($tempquerystring,1);
+ $tempurl = substr($tempurl,0,strlen($tempurl) - strlen($tempquerystring));
+ }
+ if (!empty($tempquerystring)) {
+ $tempquerystring = preg_replace("/(.*=)([^&]*)/e",
+ "'\\1' . urlencode('\\2')",
+ $tempquerystring);
+ }
+ $temp = $tempurl . $tempquerystring .
+ ((strstr($tempurl,'?')) ? "&" : "?") .
+ "extern_nav=" . urlencode($tempref) .
+ "&extern_usr=" .
+ urlencode($USER->username) .
+ "&extern_nam=" . urlencode("$USER->firstname $USER->lastname") .
+ "&extern_tim=" . urlencode($temptime) .
+ "&extern_pwd=" .
+ urlencode(md5($temptime . $USER->password));
+ redirect($temp);
+ break;
+
default:
print_header("$course->shortname: $resource->name", "$course->fullname", "$navigation $resource->name",
"", "", true, update_module_button($cm->id, $course->id, $strresource), navmenu($course, $cm));
break;
}
-
?>