workshop: removing "Login as random participant" which was used during development

This commit is contained in:
David Mudrak
2010-04-22 06:07:34 +00:00
parent 63e87951e6
commit a00e3436ef
2 changed files with 0 additions and 30 deletions
-26
View File
@@ -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());
-4
View 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)) {