Various cleanups of the installation process

This commit is contained in:
moodler 2004-07-29 18:01:32 +00:00
parent a6b87f82e9
commit 2eb68e6f6b
8 changed files with 61 additions and 40 deletions

View File

@ -193,6 +193,25 @@
}
/// Insert default values for any important configuration variables
include_once("$CFG->dirroot/lib/defaults.php");
foreach ($defaults as $name => $value) {
if (!isset($CFG->$name)) {
$CFG->$name = $value;
set_config($name, $value);
$configchange = true;
}
}
/// If any new configurations were found then send to the config page to check
if (!empty($configchange)) {
redirect("config.php");
}
/// Upgrade backup/restore system if necessary
require_once("$CFG->dirroot/backup/lib.php");
upgrade_backup_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards
@ -312,25 +331,6 @@
}
/// Insert default values for any important configuration variables
include_once("$CFG->dirroot/lib/defaults.php");
foreach ($defaults as $name => $value) {
if (!isset($CFG->$name)) {
$CFG->$name = $value;
set_config($name, $value);
$configchange = true;
}
}
/// If any new configurations were found then send to the config page to check
if (!empty($configchange)) {
redirect("config.php");
}
/// Set up the overall site name etc.
if (! $site = get_site()) {
redirect("site.php");

View File

@ -65,6 +65,7 @@
$form->shortname = "";
$form->summary = "";
$form->newsitems = 3;
$form->numsections = 0;
$form->id = "";
$form->category = 0;
$form->format = "social";

View File

@ -2,7 +2,7 @@
class CourseBlock_course_list extends MoodleBlock {
function CourseBlock_course_list ($course) {
$this->title = get_string('mycourses');
$this->title = get_string('courses');
$this->content_type = BLOCK_TYPE_LIST;
$this->course = $course;
$this->version = 2005052600;

View File

@ -15,10 +15,14 @@ class CourseBlock_site_main_menu extends MoodleBlock {
function get_content() {
global $USER, $CFG;
if($this->content !== NULL) {
if ($this->content !== NULL) {
return $this->content;
}
if (empty($this->course)) {
return '';
}
$this->content = New stdClass;
$this->content->items = array();
$this->content->icons = array();

View File

@ -15,9 +15,12 @@ class CourseBlock_social_activities extends MoodleBlock {
function get_content() {
global $USER, $CFG;
if($this->content !== NULL) {
if ($this->content !== NULL) {
return $this->content;
}
if (empty($this->course)) {
return '';
}
$this->content = New object;
$this->content->items = array();

View File

@ -628,7 +628,11 @@ function calendar_filter_controls($type, $vars = NULL, $course = NULL) {
$getvars = '&from='.$type;
break;
case 'course':
$getvars = '&from=course&id='.$_GET['id'];
if (isset($_GET['id'])) {
$getvars = '&from=course&id='.$_GET['id'];
} else {
$getvars = '&from=course';
}
if (isset($course->groupmode) and !$course->groupmode and $course->groupmodeforce) {
$groupevents = false;
}

View File

@ -438,6 +438,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
if ($course->category) {
$joins[] = "l.course='$course->id'";
} else {
$courses[0] = '';
if ($ccc = get_courses("all", "c.id ASC", "c.id,c.shortname")) {
foreach ($ccc as $cc) {
$courses[$cc->id] = "$cc->shortname";
@ -500,6 +501,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
}
$count=0;
$ldcache = array();
$tt = getdate(time());
$today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
@ -512,31 +514,37 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&");
echo "<table border=0 align=center cellpadding=3 cellspacing=3>";
echo '<table border=0 align=center cellpadding=3 cellspacing=3>';
foreach ($logs as $log) {
if ($ld = get_record("log_display", "module", "$log->module", "action", "$log->action")) {
$log->info = get_field($ld->mtable, $ld->field, "id", $log->info);
if (isset($ldcache[$log->module][$log->action])) {
$ld = $ldcache[$log->module][$log->action];
} else {
$ld = get_record('log_display', 'module', $log->module, "action", $log->action);
$ldcache[$log->module][$log->action] = $ld;
}
if ($ld) {
$log->info = get_field($ld->mtable, $ld->field, 'id', $log->info);
}
echo "<tr nowrap>";
echo '<tr nowrap="nowrap">';
if (! $course->category) {
echo "<td nowrap><font size=2><a href=\"view.php?id=$log->course\">".$courses[$log->course]."</a></td>";
echo '<td nowrap="nowrap"><font size=2><a href="view.php?id='.$log->course.'">'.$courses[$log->course].'</a></td>';
}
echo "<td nowrap align=right><font size=2>".userdate($log->time, "%a")."</td>";
echo "<td nowrap><font size=2>".userdate($log->time, $strftimedatetime)."</td>";
echo "<td nowrap><font size=2>";
link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", "ipatlas","$log->ip", 400, 700);
echo "</td>";
echo '<td nowrap align=right><font size=2>'.userdate($log->time, '%a').'</td>';
echo '<td nowrap><font size=2>'.userdate($log->time, $strftimedatetime).'</td>';
echo '<td nowrap><font size=2>';
link_to_popup_window("/lib/ipatlas/plot.php?address=$log->ip&user=$log->userid", 'ipatlas',$log->ip, 400, 700);
echo '</td>';
$fullname = fullname($log, $isteacher);
echo "<td nowrap><font size=2><a href=\"../user/view.php?id=$log->userid&course=$log->course\"><b>$fullname</b></td>";
echo "<td nowrap><font size=2>";
link_to_popup_window( make_log_url($log->module,$log->url), "fromloglive","$log->module $log->action", 400, 600);
echo "</td>";
echo "<td nowrap><font size=2>$log->info</td>";
echo "</tr>";
echo '<td nowrap><font size=2><a href="../user/view.php?id='."$log->userid&course=$log->course".'"><b>'.$fullname.'</b></td>';
echo '<td nowrap><font size=2>';
link_to_popup_window( make_log_url($log->module,$log->url), 'fromloglive',"$log->module $log->action", 400, 600);
echo '</td>';
echo '<td nowrap><font size=2>'.$log->info.'</td>';
echo '</tr>';
}
echo "</table>";
echo '</table>';
print_paging_bar($totalcount, $page, $perpage, "$url&perpage=$perpage&");
}

View File

@ -12,6 +12,7 @@
"country" => "",
"debug" => 7,
"deleteunconfirmed" => 168,
"digestmailtime" => 17,
"displayloginfailures" => '',
"enablerssfeeds" => 0,
"enrol" => 'internal',