workshop: removing "Login as random participant" which was used during development
authorDavid Mudrak <david.mudrak@gmail.com>
Thu, 22 Apr 2010 06:07:34 +0000 (06:07 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Thu, 22 Apr 2010 06:07:34 +0000 (06:07 +0000)
mod/workshop/loginas.php [deleted file]
mod/workshop/tabs.php

diff --git a/mod/workshop/loginas.php b/mod/workshop/loginas.php
deleted file mode 100644 (file)
index 1cf7ef2..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
- * Temporary script to log-in as a random workshop participant - useful for testing
- */
-
-require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
-require_once(dirname(__FILE__).'/locallib.php');
-
-$cmid       = required_param('cmid', PARAM_INT); // course_module ID, or
-
-$cm         = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
-$course     = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
-$workshop   = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
-
-require_login($course, true, $cm);
-require_capability('moodle/user:loginas', get_context_instance(CONTEXT_COURSE, $course->id));
-
-$workshop = new workshop($workshop, $cm, $course);
-
-$authors = $workshop->get_potential_authors(false);
-$reviewers = $workshop->get_potential_reviewers(false);
-$participants = array_intersect_key($authors, $reviewers);
-$randomid = array_rand($participants);
-
-redirect("{$CFG->wwwroot}/course/loginas.php?id={$course->id}&user={$randomid}&return=1&sesskey=" . sesskey());
index 27b08b0..63da728 100644 (file)
@@ -55,10 +55,6 @@ if (has_capability('mod/workshop:submit', $PAGE->context)) {
 if (has_capability('mod/workshop:allocate', $PAGE->context)) {
     $row[] = new tabobject('allocation', $workshop->allocation_url()->out(), get_string('allocate', 'workshop'));
 }
-if (has_capability('moodle/user:loginas', get_system_context())) {
-    // todo remove these tools from a production release
-    $row[] = new tabobject('loginas', "loginas.php?cmid={$cm->id}", 'Login as a random participant');
-}
 $tabs[] = $row;
 
 if ($currenttab == 'allocation' and !empty($allocators)) {