mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
removed unnecessary calls to get_site()
This commit is contained in:
parent
afd97e8449
commit
222ac91bc9
26 changed files with 219 additions and 415 deletions
|
@ -1252,11 +1252,6 @@ function print_course($course, $width="100%") {
|
|||
$enrol = new enrolment_plugin;
|
||||
}
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Could not find a site!");
|
||||
}
|
||||
|
||||
|
||||
print_simple_box_start("center", "$width", $THEME->cellcontent, 5, "coursebox");
|
||||
|
||||
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
|
||||
|
@ -1274,7 +1269,7 @@ function print_course($course, $width="100%") {
|
|||
$teacher->role = $course->teacher;
|
||||
}
|
||||
$fullname = fullname($teacher, isteacher($course->id)); // is the USER a teacher of that course
|
||||
echo "$teacher->role: <a href=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=$site->id\">$fullname</a><br />";
|
||||
echo "$teacher->role: <a href=\"$CFG->wwwroot/user/view.php?id=$teacher->id&course=".SITEID."\">$fullname</a><br />";
|
||||
}
|
||||
}
|
||||
echo "</font></p>";
|
||||
|
|
|
@ -179,8 +179,7 @@
|
|||
|
||||
rebuild_course_cache($cm->course);
|
||||
|
||||
$site = get_site();
|
||||
if ($site->id == $cm->course) {
|
||||
if (SITEID == $cm->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$cm->course");
|
||||
|
@ -224,8 +223,7 @@
|
|||
|
||||
rebuild_course_cache($section->course);
|
||||
|
||||
$site = get_site();
|
||||
if ($site->id == $section->course) {
|
||||
if (SITEID == $section->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$section->course");
|
||||
|
@ -249,8 +247,7 @@
|
|||
error("Could not update the indent level on that course module");
|
||||
}
|
||||
|
||||
$site = get_site();
|
||||
if ($site->id == $cm->course) {
|
||||
if (SITEID == $cm->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$cm->course");
|
||||
|
@ -271,8 +268,7 @@
|
|||
|
||||
rebuild_course_cache($cm->course);
|
||||
|
||||
$site = get_site();
|
||||
if ($site->id == $cm->course) {
|
||||
if (SITEID == $cm->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$cm->course");
|
||||
|
@ -297,14 +293,12 @@
|
|||
error("This module doesn't exist");
|
||||
}
|
||||
|
||||
$site = get_site();
|
||||
|
||||
if ($module->visible and ($section->visible or ($site->id == $cm->course))) {
|
||||
if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
|
||||
show_course_module($cm->id);
|
||||
rebuild_course_cache($cm->course);
|
||||
}
|
||||
|
||||
if ($site->id == $cm->course) {
|
||||
if (SITEID == $cm->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$cm->course");
|
||||
|
@ -325,8 +319,7 @@
|
|||
|
||||
rebuild_course_cache($cm->course);
|
||||
|
||||
$site = get_site();
|
||||
if ($site->id == $cm->course) {
|
||||
if (SITEID == $cm->course) {
|
||||
redirect($CFG->wwwroot);
|
||||
} else {
|
||||
redirect("view.php?id=$cm->course");
|
||||
|
|
|
@ -34,11 +34,7 @@
|
|||
|
||||
global $CFG;
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Invalid site!");
|
||||
}
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
$strfiles = get_string("sitefiles");
|
||||
} else {
|
||||
$strfiles = get_string("files");
|
||||
|
@ -59,7 +55,7 @@
|
|||
$fullnav = "<a href=\"index.php?id=$course->id&wdir=/\">$strfiles</a> $navigation -> ".$dirs[$numdirs-1];
|
||||
}
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
print_header("$course->shortname: $strfiles", "$course->fullname",
|
||||
"<a href=\"../$CFG->admin/index.php\">".get_string("administration").
|
||||
"</a> -> $fullnav", $formfield);
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
global $CFG;
|
||||
|
||||
if (empty($courseid)) {
|
||||
if ($site = get_site()) {
|
||||
$courseid = $site->id;
|
||||
}
|
||||
$courseid = SITEID;
|
||||
}
|
||||
|
||||
$course = get_record("course","id",$courseid);
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<?PHP // $Id$
|
||||
|
||||
/// CONSTANTS /////////////////////////////////////////////////////////////
|
||||
|
||||
define('SITEID', 1);
|
||||
|
||||
|
||||
/// FUNCTIONS FOR DATABASE HANDLING ////////////////////////////////
|
||||
|
||||
/**
|
||||
* execute a given sql command string
|
||||
*
|
||||
|
@ -947,9 +953,7 @@ function get_user_info_from_db($field, $value) {
|
|||
$user->admin = true;
|
||||
}
|
||||
|
||||
if ($site = get_site()) {
|
||||
$user->student[$site->id] = isstudent($site->id, $user->id);
|
||||
}
|
||||
$user->student[SITEID] = isstudent(SITEID, $user->id);
|
||||
|
||||
/// Determine enrolments based on current enrolment module
|
||||
|
||||
|
@ -1173,8 +1177,7 @@ function get_course_students($courseid, $sort="s.timeaccess", $dir="", $page=0,
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$courseid' AND ";
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
if ($courseid == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -1367,8 +1370,7 @@ function search_users($courseid, $groupid, $searchtext, $sort='', $exceptions=''
|
|||
$order = '';
|
||||
}
|
||||
|
||||
$site = get_site();
|
||||
if (!$courseid or $courseid == $site->id) {
|
||||
if (!$courseid or $courseid == SITEID) {
|
||||
if (!$admins = get_records_sql("SELECT u.id, u.firstname, u.lastname, u.email
|
||||
FROM {$CFG->prefix}user u,
|
||||
{$CFG->prefix}user_admins s
|
||||
|
@ -2279,9 +2281,9 @@ function add_to_log($courseid, $module, $action, $url="", $info="", $cm=0, $user
|
|||
echo "<P>Error: Could not insert a new entry to the Moodle log</P>"; // Don't throw an error
|
||||
}
|
||||
if (!$user and isset($USER->id)) {
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
update_user_in_db();
|
||||
if ($courseid == SITEID) {
|
||||
$db->Execute("UPDATE {$CFG->prefix}user SET lastIP='$REMOTE_ADDR', lastaccess='$timenow'
|
||||
WHERE id = '$USER->id' ");
|
||||
} else if (isstudent($courseid)) {
|
||||
$db->Execute("UPDATE {$CFG->prefix}user_students SET timeaccess = '$timenow' ".
|
||||
"WHERE course = '$courseid' AND userid = '$userid'");
|
||||
|
|
|
@ -38,10 +38,6 @@
|
|||
|
||||
global $CFG;
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Invalid site!");
|
||||
}
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
|
|
@ -37,11 +37,7 @@
|
|||
|
||||
global $CFG;
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Invalid site!");
|
||||
}
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
$strfiles = get_string("sitefiles");
|
||||
} else {
|
||||
$strfiles = get_string("files");
|
||||
|
@ -64,21 +60,21 @@
|
|||
|
||||
print_header();
|
||||
?>
|
||||
<script language="javscript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(url) {
|
||||
var str_url = url;
|
||||
//if(document.all) {
|
||||
// window.returnValue = str_url;
|
||||
// window.close();
|
||||
//}
|
||||
//else {
|
||||
window.opener.document.forms[0].url.value = str_url;
|
||||
window.close();
|
||||
//}
|
||||
}
|
||||
<script language="javscript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(url) {
|
||||
var str_url = url;
|
||||
//if(document.all) {
|
||||
// window.returnValue = str_url;
|
||||
// window.close();
|
||||
//}
|
||||
//else {
|
||||
window.opener.document.forms[0].url.value = str_url;
|
||||
window.close();
|
||||
//}
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
</script>
|
||||
<?php
|
||||
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
|
||||
|
@ -89,7 +85,7 @@
|
|||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
print_heading(get_string("publicsitefileswarning"), "center", 2);
|
||||
}
|
||||
|
||||
|
@ -544,33 +540,33 @@
|
|||
break;
|
||||
|
||||
case "torte":
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "cancel";
|
||||
clearfilelist();
|
||||
|
||||
|
|
|
@ -383,8 +383,7 @@ function require_login($courseid=0, $autologinguest=true) {
|
|||
|
||||
// Check that the user account is properly set up
|
||||
if (user_not_fully_set_up($USER)) {
|
||||
$site = get_site();
|
||||
redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=$site->id");
|
||||
redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=SITEID");
|
||||
die;
|
||||
}
|
||||
|
||||
|
@ -588,8 +587,7 @@ function isstudent($courseid, $userid=0) {
|
|||
return false;
|
||||
}
|
||||
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
if ($courseid == SITEID) {
|
||||
if (!$userid) {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
|
@ -968,9 +966,8 @@ function add_admin($userid) {
|
|||
$admin->userid = $userid;
|
||||
|
||||
// any admin is also a teacher on the site course
|
||||
$site = get_site();
|
||||
if (!record_exists('user_teachers', 'course', $site->id, 'userid', $userid)) {
|
||||
if (!add_teacher($userid, $site->id)) {
|
||||
if (!record_exists('user_teachers', 'course', SITEID, 'userid', $userid)) {
|
||||
if (!add_teacher($userid, SITEID)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -987,8 +984,7 @@ function remove_admin($userid) {
|
|||
global $db;
|
||||
|
||||
// remove also from the list of site teachers
|
||||
$site = get_site();
|
||||
remove_teacher($userid, $site->id);
|
||||
remove_teacher($userid, SITEID);
|
||||
|
||||
return delete_records("user_admins", "userid", $userid);
|
||||
}
|
||||
|
@ -1534,8 +1530,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $a
|
|||
return true;
|
||||
} else {
|
||||
mtrace("ERROR: $mail->ErrorInfo");
|
||||
$site = get_site();
|
||||
add_to_log($site->id, "library", "mailer", $_SERVER["REQUEST_URI"], "ERROR: $mail->ErrorInfo");
|
||||
add_to_log(SITEID, "library", "mailer", $_SERVER["REQUEST_URI"], "ERROR: $mail->ErrorInfo");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
<A HREF=\"$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id\">$fullname</A> -> $strpasswordchanged", $focus);
|
||||
notice($strpasswordchanged, "$CFG->wwwroot/user/view.php?id=$USER->id&course=$id");
|
||||
} else {
|
||||
$site = get_site();
|
||||
add_to_log($site->id, "user", "change password", "view.php?id=$user->id&course=$site->id", "$course->id");
|
||||
add_to_log(SITEID, "user", "change password", "view.php?id=$user->id&course=".SITEID, "$course->id");
|
||||
print_header($strpasswordchanged, $strpasswordchanged, $strpasswordchanged, "");
|
||||
notice($strpasswordchanged, "$CFG->wwwroot/");
|
||||
}
|
||||
|
|
|
@ -74,8 +74,7 @@
|
|||
$SESSION->justloggedin = true;
|
||||
|
||||
if (user_not_fully_set_up($USER)) {
|
||||
$site = get_site();
|
||||
redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=$site->id");
|
||||
redirect("$CFG->wwwroot/user/edit.php?id=$USER->id&course=".SITEID);
|
||||
|
||||
} else if (strpos($wantsurl, $CFG->wwwroot) === 0) { /// Matches site address
|
||||
redirect($wantsurl);
|
||||
|
|
|
@ -425,8 +425,7 @@ function assignment_count_real_submissions($assignment, $groupid=0) {
|
|||
AND a.userid = g.userid ");
|
||||
} else {
|
||||
$select = "s.course = '$assignment->course' AND";
|
||||
$site = get_site();
|
||||
if ($assignment->course == $site->id) {
|
||||
if ($assignment->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
return count_records_sql("SELECT COUNT(*)
|
||||
|
@ -451,8 +450,7 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
|
|||
}
|
||||
|
||||
$select = "s.course = '$assignment->course' AND";
|
||||
$site = get_site();
|
||||
if ($assignment->course == $site->id) {
|
||||
if ($assignment->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
return get_records_sql("SELECT a.*
|
||||
|
@ -470,8 +468,7 @@ function assignment_get_users_done($assignment) {
|
|||
global $CFG;
|
||||
|
||||
$select = "s.course = '$assignment->course' AND";
|
||||
$site = get_site();
|
||||
if ($assignment->course == $site->id) {
|
||||
if ($assignment->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
return get_records_sql("SELECT u.*
|
||||
|
@ -497,8 +494,8 @@ function assignment_get_unmailed_submissions($cutofftime) {
|
|||
AND s.assignment = a.id
|
||||
AND s.userid = us.userid
|
||||
AND a.course = us.course");
|
||||
$site = get_site();
|
||||
if (record_exists('assignment', 'course', $site->id)) {
|
||||
$siteid = SITEID;
|
||||
if (record_exists('assignment', 'course', $siteid)) {
|
||||
$records += get_records_sql("SELECT s.*, a.course, a.name
|
||||
FROM {$CFG->prefix}assignment_submissions s,
|
||||
{$CFG->prefix}assignment a,
|
||||
|
@ -508,7 +505,7 @@ function assignment_get_unmailed_submissions($cutofftime) {
|
|||
AND s.timemarked > 0
|
||||
AND s.assignment = a.id
|
||||
AND s.userid = us.userid
|
||||
AND a.course = $site->id");
|
||||
AND a.course = $siteid");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -387,8 +387,7 @@ function attendance_get_course_students($courseid, $sort="u.lastaccess DESC") {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$courseid' AND";
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
if ($courseid == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat,
|
||||
|
|
|
@ -235,8 +235,7 @@ function dialogue_get_users_done($dialogue) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$dialogue->course' AND";
|
||||
$site = get_site();
|
||||
if ($courseid == $site->id) {
|
||||
if ($courseid == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
if (!$students = get_records_sql("SELECT u.*
|
||||
|
|
|
@ -239,8 +239,7 @@ function exercise_count_student_submissions($exercise) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
if ($exercise->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -489,8 +488,7 @@ function exercise_get_best_submission_grades($exercise) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
if ($exercise->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -543,8 +541,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
if ($exercise->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -570,8 +567,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
if ($exercise->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -591,8 +587,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
if ($exercise->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -615,8 +610,7 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
if ($exercise->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -670,8 +664,7 @@ function exercise_get_ungraded_assessments_student($exercise) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$exercise->course' AND";
|
||||
$site = get_site();
|
||||
if ($exercise->course == $site->id) {
|
||||
if ($exercise->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
global $CFG;
|
||||
|
||||
if (empty($courseid)) {
|
||||
if ($site = get_site()) {
|
||||
$courseid = $site->id;
|
||||
}
|
||||
$courseid = SITEID;
|
||||
}
|
||||
|
||||
$GLOSSARY_CONCEPT_IS_ENTRY = 0;
|
||||
|
|
|
@ -316,8 +316,7 @@ function journal_get_users_done($journal) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$journal->course' AND";
|
||||
$site = get_site();
|
||||
if ($journal->course == $site->id) {
|
||||
if ($journal->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -369,8 +368,7 @@ function journal_count_entries($journal, $groupid=0) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$journal->course' AND";
|
||||
$site = get_site();
|
||||
if ($journal->course == $site->id) {
|
||||
if ($journal->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@
|
|||
|
||||
global $CFG,$THEME;
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Invalid site!");
|
||||
}
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
$strfiles = get_string("sitefiles");
|
||||
} else {
|
||||
$strfiles = get_string("files");
|
||||
|
@ -64,14 +60,14 @@
|
|||
|
||||
print_header();
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(txt) {
|
||||
opener.document.forms['form'].reference.value = txt;
|
||||
window.close();
|
||||
}
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(txt) {
|
||||
opener.document.forms['form'].reference.value = txt;
|
||||
window.close();
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
</script>
|
||||
<?php
|
||||
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
|
||||
|
@ -82,7 +78,7 @@
|
|||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
print_heading(get_string("publicsitefileswarning"), "center", 2);
|
||||
}
|
||||
|
||||
|
@ -537,33 +533,33 @@
|
|||
break;
|
||||
|
||||
case "torte":
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "cancel";
|
||||
clearfilelist();
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
global $CFG;
|
||||
|
||||
if (empty($courseid)) {
|
||||
if ($site = get_site()) {
|
||||
$courseid = $site->id;
|
||||
}
|
||||
$courseid = SITEID;
|
||||
}
|
||||
|
||||
switch ($CFG->dbtype) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2004080801;
|
||||
$module->requires = 2004073000; // Requires this Moodle version
|
||||
$module->requires = 2004092901; // Requires this Moodle version
|
||||
$module->cron = 0;
|
||||
|
||||
?>
|
||||
|
|
|
@ -37,11 +37,7 @@
|
|||
|
||||
global $CFG,$THEME,$ME;
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Invalid site!");
|
||||
}
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
$strfiles = get_string("sitefiles");
|
||||
} else {
|
||||
$strfiles = get_string("files");
|
||||
|
@ -64,14 +60,14 @@
|
|||
|
||||
print_header();
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(txt) {
|
||||
opener.document.forms['form'].reference.value = txt;
|
||||
window.close();
|
||||
}
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(txt) {
|
||||
opener.document.forms['form'].reference.value = txt;
|
||||
window.close();
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
</script>
|
||||
<?php
|
||||
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
|
||||
|
@ -82,7 +78,7 @@
|
|||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
print_heading(get_string("publicsitefileswarning"), "center", 2);
|
||||
}
|
||||
|
||||
|
@ -537,33 +533,33 @@
|
|||
break;
|
||||
|
||||
case "torte":
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "cancel";
|
||||
clearfilelist();
|
||||
|
||||
|
@ -684,7 +680,7 @@ function displaydir ($wdir) {
|
|||
$dirlist[] = $file;
|
||||
} else {
|
||||
if ((basename(strtolower($file),".zip") != basename(strtolower($file))) || (basename(strtolower($file),".pif") != basename(strtolower($file))))
|
||||
$filelist[] = $file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($directory);
|
||||
|
|
|
@ -1,126 +1 @@
|
|||
<?PHP // $Id$
|
||||
//This function provides automatic linking to
|
||||
//wiki pages when its page title is found inside every Moodle text
|
||||
//It's based in the glosssary filter by Williams Castillo
|
||||
//Modifications by mchurch. Enjoy! :-)
|
||||
|
||||
require_once($CFG->dirroot.'/mod/wiki/lib.php');
|
||||
|
||||
function wiki_filter($courseid, $text) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
if (empty($courseid)) {
|
||||
if ($site = get_site()) {
|
||||
$courseid = $site->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (!($course = get_record('course', 'id', $courseid))) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
// Get all wikis for this course.
|
||||
$wikis = wiki_get_course_wikis($courseid);
|
||||
if (empty($wikis)) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
// Walk through each wiki, and get entries.
|
||||
foreach ($wikis as $wiki) {
|
||||
if ($wiki_entries = wiki_get_entries($wiki)) {
|
||||
|
||||
// Walk through each entry and get the pages.
|
||||
foreach ($wiki_entries as $wiki_entry) {
|
||||
if ($wiki_pages = get_records('wiki_pages', 'wiki', $wiki_entry->id)) {
|
||||
|
||||
// Walk through each page and filter.
|
||||
foreach ($wiki_pages as $wiki_page) {
|
||||
$startlink = '<a class="autolink" title="Wiki" href="'
|
||||
.$CFG->wwwroot.'/mod/wiki/view.php?wid='.$wiki->id
|
||||
.'&userid='.$wiki_entry->userid
|
||||
.'&groupid='.$wiki_entry->groupid
|
||||
.'&wikipage='.$wiki_page->pagename.'">';
|
||||
$text = wiki_link_names($text, $wiki_page->pagename, $startlink, '</a>');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function wiki_link_names($text,$name,$href_tag_begin,$href_tag_end = "</a>") {
|
||||
|
||||
$list_of_words_cp = strip_tags($name);
|
||||
|
||||
$list_of_words_cp = trim($list_of_words_cp,'|');
|
||||
|
||||
$list_of_words_cp = trim($list_of_words_cp);
|
||||
|
||||
$list_of_words_cp = preg_quote($list_of_words_cp,'/');
|
||||
|
||||
$invalidprefixs = "([a-zA-Z0-9])";
|
||||
$invalidsufixs = "([a-zA-Z0-9])";
|
||||
|
||||
//Avoid seaching in the string if it's inside invalidprefixs and invalidsufixs
|
||||
$words = array();
|
||||
$regexp = '/'.$invalidprefixs.'('.$list_of_words_cp.')|('.$list_of_words_cp.')'.$invalidsufixs.'/is';
|
||||
preg_match_all($regexp,$text,$list_of_words);
|
||||
|
||||
foreach (array_unique($list_of_words[0]) as $key=>$value) {
|
||||
$words['<*'.$key.'*>'] = $value;
|
||||
}
|
||||
if (!empty($words)) {
|
||||
$text = str_replace($words,array_keys($words),$text);
|
||||
}
|
||||
|
||||
//Now avoid searching inside the <nolink>tag
|
||||
$excludes = array();
|
||||
preg_match_all('/<nolink>(.+?)<\/nolink>/is',$text,$list_of_excludes);
|
||||
foreach (array_unique($list_of_excludes[0]) as $key=>$value) {
|
||||
$excludes['<+'.$key.'+>'] = $value;
|
||||
}
|
||||
if (!empty($excludes)) {
|
||||
$text = str_replace($excludes,array_keys($excludes),$text);
|
||||
}
|
||||
|
||||
//Now avoid searching inside links
|
||||
$links = array();
|
||||
preg_match_all('/<A[\s](.+?)>(.+?)<\/A>/is',$text,$list_of_links);
|
||||
foreach (array_unique($list_of_links[0]) as $key=>$value) {
|
||||
$links['<@'.$key.'@>'] = $value;
|
||||
}
|
||||
if (!empty($links)) {
|
||||
$text = str_replace($links,array_keys($links),$text);
|
||||
}
|
||||
|
||||
//Now avoid searching inside every tag
|
||||
$final = array();
|
||||
preg_match_all('/<(.+?)>/is',$text,$list_of_tags);
|
||||
foreach (array_unique($list_of_tags[0]) as $key=>$value) {
|
||||
$final['<|'.$key.'|>'] = $value;
|
||||
}
|
||||
if (!empty($final)) {
|
||||
$text = str_replace($final,array_keys($final),$text);
|
||||
}
|
||||
|
||||
$text = preg_replace('/('.$list_of_words_cp.')/is', $href_tag_begin.'$1'.$href_tag_end,$text);
|
||||
|
||||
//Now rebuild excluded areas
|
||||
if (!empty($final)) {
|
||||
$text = str_replace(array_keys($final),$final,$text);
|
||||
}
|
||||
if (!empty($links)) {
|
||||
$text = str_replace(array_keys($links),$links,$text);
|
||||
}
|
||||
if (!empty($excludes)) {
|
||||
$text = str_replace(array_keys($excludes),$excludes,$text);
|
||||
}
|
||||
if (!empty($words)) {
|
||||
$text = str_replace(array_keys($words),$words,$text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
?>
|
||||
<?PHP // $Id$
//This function provides automatic linking to
//wiki pages when its page title is found inside every Moodle text
//It's based in the glosssary filter by Williams Castillo
//Modifications by mchurch. Enjoy! :-)
require_once($CFG->dirroot.'/mod/wiki/lib.php');
function wiki_filter($courseid, $text) {
global $CFG;
if (empty($courseid)) {
$courseid = SITEID;
}
}
if (!($course = get_record('course', 'id', $courseid))) {
return $text;
}
// Get all wikis for this course.
$wikis = wiki_get_course_wikis($courseid);
if (empty($wikis)) {
return $text;
}
// Walk through each wiki, and get entries.
foreach ($wikis as $wiki) {
if ($wiki_entries = wiki_get_entries($wiki)) {
// Walk through each entry and get the pages.
foreach ($wiki_entries as $wiki_entry) {
if ($wiki_pages = get_records('wiki_pages', 'wiki', $wiki_entry->id)) {
// Walk through each page and filter.
foreach ($wiki_pages as $wiki_page) {
$startlink = '<a class="autolink" title="Wiki" href="'
.$CFG->wwwroot.'/mod/wiki/view.php?wid='.$wiki->id
.'&userid='.$wiki_entry->userid
.'&groupid='.$wiki_entry->groupid
.'&wikipage='.$wiki_page->pagename.'">';
$text = wiki_link_names($text, $wiki_page->pagename, $startlink, '</a>');
}
}
}
}
}
return $text;
}
function wiki_link_names($text,$name,$href_tag_begin,$href_tag_end = "</a>") {
$list_of_words_cp = strip_tags($name);
$list_of_words_cp = trim($list_of_words_cp,'|');
$list_of_words_cp = trim($list_of_words_cp);
$list_of_words_cp = preg_quote($list_of_words_cp,'/');
$invalidprefixs = "([a-zA-Z0-9])";
$invalidsufixs = "([a-zA-Z0-9])";
//Avoid seaching in the string if it's inside invalidprefixs and invalidsufixs
$words = array();
$regexp = '/'.$invalidprefixs.'('.$list_of_words_cp.')|('.$list_of_words_cp.')'.$invalidsufixs.'/is';
preg_match_all($regexp,$text,$list_of_words);
foreach (array_unique($list_of_words[0]) as $key=>$value) {
$words['<*'.$key.'*>'] = $value;
}
if (!empty($words)) {
$text = str_replace($words,array_keys($words),$text);
}
//Now avoid searching inside the <nolink>tag
$excludes = array();
preg_match_all('/<nolink>(.+?)<\/nolink>/is',$text,$list_of_excludes);
foreach (array_unique($list_of_excludes[0]) as $key=>$value) {
$excludes['<+'.$key.'+>'] = $value;
}
if (!empty($excludes)) {
$text = str_replace($excludes,array_keys($excludes),$text);
}
//Now avoid searching inside links
$links = array();
preg_match_all('/<A[\s](.+?)>(.+?)<\/A>/is',$text,$list_of_links);
foreach (array_unique($list_of_links[0]) as $key=>$value) {
$links['<@'.$key.'@>'] = $value;
}
if (!empty($links)) {
$text = str_replace($links,array_keys($links),$text);
}
//Now avoid searching inside every tag
$final = array();
preg_match_all('/<(.+?)>/is',$text,$list_of_tags);
foreach (array_unique($list_of_tags[0]) as $key=>$value) {
$final['<|'.$key.'|>'] = $value;
}
if (!empty($final)) {
$text = str_replace($final,array_keys($final),$text);
}
$text = preg_replace('/('.$list_of_words_cp.')/is', $href_tag_begin.'$1'.$href_tag_end,$text);
//Now rebuild excluded areas
if (!empty($final)) {
$text = str_replace(array_keys($final),$final,$text);
}
if (!empty($links)) {
$text = str_replace(array_keys($links),$links,$text);
}
if (!empty($excludes)) {
$text = str_replace(array_keys($excludes),$excludes,$text);
}
if (!empty($words)) {
$text = str_replace(array_keys($words),$words,$text);
}
return $text;
}
?>
|
|
@ -407,18 +407,17 @@ function wiki_get_other_wikis(&$wiki, &$user, &$course, $currentid=0) {
|
|||
$mygroupid = mygroupid($course->id);
|
||||
$isteacher = isteacher($course->id, $user->id);
|
||||
$isteacheredit = isteacheredit($course->id, $user->id);
|
||||
$site = get_site();
|
||||
|
||||
switch ($wiki->wtype) {
|
||||
|
||||
case 'student':
|
||||
/// Get all the existing entries for this wiki.
|
||||
$wiki_entries = wiki_get_entries($wiki, 'student');
|
||||
if ($isteacher and ($site->id != $course->id)) {
|
||||
if ($isteacher and (SITEID != $course->id)) {
|
||||
|
||||
/// If the user is an editing teacher, or a non-editing teacher not assigned to a group, show all student
|
||||
/// wikis, regardless of creation.
|
||||
if (($site->id != $course->id) and ($isteacheredit or ($groupmode == NOGROUPS))) {
|
||||
if ((SITEID != $course->id) and ($isteacheredit or ($groupmode == NOGROUPS))) {
|
||||
|
||||
if ($students = get_course_students($course->id)) {
|
||||
/// Default pagename is dependent on the wiki settings.
|
||||
|
@ -494,7 +493,7 @@ function wiki_get_other_wikis(&$wiki, &$user, &$course, $currentid=0) {
|
|||
/// group (for separate groups) or there are visible groups, or if this is
|
||||
/// a site-level wiki, and they are an administrator.
|
||||
if (($groupmode == VISIBLEGROUPS) or
|
||||
(($site->id == $course->id) and isadmin())) {
|
||||
((SITEID == $course->id) and isadmin())) {
|
||||
$viewall = true;
|
||||
}
|
||||
else if ($groupmode == SEPARATEGROUPS) {
|
||||
|
@ -706,7 +705,6 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
|
|||
/// Get the groupmode. It's been added to the wiki object.
|
||||
$groupmode = groupmode($course, $wiki);
|
||||
$mygroupid = mygroupid($course->id);
|
||||
$site = get_site();
|
||||
|
||||
switch ($wiki->wtype) {
|
||||
|
||||
|
@ -715,7 +713,7 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
|
|||
/// A user can create their own wiki at the site level.
|
||||
if ($userid == 0) {
|
||||
return (isstudent($course->id, $user->id) or
|
||||
(($site->id == $course->id) and !empty($user) and !isguest()));
|
||||
((SITEID == $course->id) and !empty($user) and !isguest()));
|
||||
}
|
||||
/// An editing teacher can create any student wiki, or
|
||||
/// a non-editing teacher, if not assigned to a group can create any student wiki, or if assigned to a group can
|
||||
|
@ -730,7 +728,7 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
|
|||
/// If mode is 'nogroups', then all participants can add wikis.
|
||||
if (!$groupmode) {
|
||||
return (isstudent($course->id, $user->id) or isteacher($course->id, $user->id) or
|
||||
(($site->id == $course->id) and !empty($user) and !isguest()));
|
||||
((SITEID == $course->id) and !empty($user) and !isguest()));
|
||||
}
|
||||
/// If not requesting a group, must be a member of a group.
|
||||
else if ($groupid == 0) {
|
||||
|
@ -747,7 +745,7 @@ function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
|
|||
case 'teacher':
|
||||
/// If mode is 'nogroups', then all teachers can add wikis.
|
||||
if (!$groupmode) {
|
||||
return (isteacher($course->id, $user->id) or (($site->id == $course->id) and isadmin()));
|
||||
return (isteacher($course->id, $user->id) or ((SITEID == $course->id) and isadmin()));
|
||||
}
|
||||
/// If not requesting a group, must be a member of a group.
|
||||
else if ($groupid == 0) {
|
||||
|
@ -771,7 +769,6 @@ function wiki_can_edit_entry(&$wiki_entry, &$wiki, &$user, &$course) {
|
|||
$can_edit = false;
|
||||
$groupmode = groupmode($course, $wiki);
|
||||
$mygroupid = mygroupid($course->id);
|
||||
$site = get_site();
|
||||
|
||||
/// Editing teacher's and admins can edit all wikis, non-editing teachers can edit wikis in their groups,
|
||||
/// or all wikis if group mode is 'no groups' or they don't belong to a group.
|
||||
|
@ -798,7 +795,7 @@ function wiki_can_edit_entry(&$wiki_entry, &$wiki, &$user, &$course) {
|
|||
/// If mode is 'nogroups', then all participants can edit the wiki.
|
||||
else {
|
||||
$can_edit = (isstudent($course->id, $user->id) or isteacher($course->id, $user->id) or
|
||||
(($site->id == $course->id) and !empty($user) and !isguest()));
|
||||
((SITEID == $course->id) and !empty($user) and !isguest()));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -809,7 +806,7 @@ function wiki_can_edit_entry(&$wiki_entry, &$wiki, &$user, &$course) {
|
|||
$can_edit = (isteacher($course->id, $user->id) and ismember($wiki_entry->groupid, $user->id));
|
||||
}
|
||||
else {
|
||||
$can_edit = (isteacher($course->id, $user->id) or (($site->id == $course->id) and isadmin()));
|
||||
$can_edit = (isteacher($course->id, $user->id) or ((SITEID == $course->id) and isadmin()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -37,11 +37,7 @@
|
|||
|
||||
global $CFG, $THEME, $ME;
|
||||
|
||||
if (! $site = get_site()) {
|
||||
error("Invalid site!");
|
||||
}
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
$strfiles = get_string("sitefiles");
|
||||
} else {
|
||||
$strfiles = get_string("files");
|
||||
|
@ -64,14 +60,14 @@
|
|||
|
||||
print_header();
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(txt) {
|
||||
opener.document.forms['form'].initialcontent.value = txt;
|
||||
window.close();
|
||||
}
|
||||
<script language="javascript" type="text/javascript">
|
||||
<!--
|
||||
function set_value(txt) {
|
||||
opener.document.forms['form'].initialcontent.value = txt;
|
||||
window.close();
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
</script>
|
||||
<?php
|
||||
|
||||
echo '<table border="0" cellpadding="3" cellspacing="0" width="100%">';
|
||||
|
@ -82,7 +78,7 @@
|
|||
echo '</tr>';
|
||||
echo '</table>';
|
||||
|
||||
if ($course->id == $site->id) {
|
||||
if ($course->id == SITEID) {
|
||||
print_heading(get_string("publicsitefileswarning"), "center", 2);
|
||||
}
|
||||
|
||||
|
@ -531,33 +527,33 @@
|
|||
break;
|
||||
|
||||
case "torte":
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
if($_POST)
|
||||
{
|
||||
while(list($key, $val) = each($_POST))
|
||||
{
|
||||
if(ereg("file([0-9]+)", $key, $regs))
|
||||
{
|
||||
$file = $val;
|
||||
}
|
||||
}
|
||||
if(@filetype($CFG->dataroot ."/". $course->id . $file) == "file")
|
||||
{
|
||||
if(mimeinfo("icon", $file) == "image.gif")
|
||||
{
|
||||
$url = $CFG->wwwroot ."/file.php?file=/" .$course->id . $file;
|
||||
runjavascript($url);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "File is not a image!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "You cannot insert FOLDER into richtext editor!!!";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "cancel";
|
||||
clearfilelist();
|
||||
|
||||
|
|
|
@ -1205,8 +1205,7 @@ function workshop_get_student_submissions($workshop, $order = "title") {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
if ($workshop->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -250,8 +250,7 @@ function workshop_count_student_submissions($workshop) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
if ($workshop->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -515,8 +514,7 @@ function workshop_get_student_assessments($workshop, $user) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
if ($workshop->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -538,8 +536,7 @@ function workshop_get_student_submission_assessments($workshop) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
if ($workshop->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -608,8 +605,7 @@ function workshop_get_ungraded_assessments_student($workshop) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
if ($workshop->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
@ -668,8 +664,7 @@ function workshop_get_users_done($workshop) {
|
|||
|
||||
// make sure it works on the site course
|
||||
$select = "s.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
if ($workshop->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,7 @@
|
|||
$guest = get_guest();
|
||||
$exceptions .= $guest->id;
|
||||
|
||||
$site = get_site();
|
||||
if ($course->id == $site->id) { // Show all site users (even unconfirmed)
|
||||
if ($course->id == SITEID) { // Show all site users (even unconfirmed)
|
||||
$students = get_users(true, '', true, $exceptions, $sort.' '.$dir, $firstinitial, $lastinitial, $page*$perpage, $perpage);
|
||||
$totalcount = get_users(false, '', true, '', '', '', '') - 1; // -1 to not count guest user
|
||||
if ($firstinitial or $lastinitial) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue