Variety of small fixes, but mostly related to how the recent activity

block is constructed.  A new function exists to pump these notes out
in a standard way :  print_recent_activity_note.

Module dependencies also updated because of this.
This commit is contained in:
moodler 2005-03-10 13:30:57 +00:00
parent 0710337efe
commit 8f7dc7f1c7
26 changed files with 247 additions and 322 deletions

View File

@ -364,8 +364,14 @@ function stripslashes_recursive($var) {
* @return string
*/
function break_up_long_words($string, $maxsize=20, $cutchar=' ') {
static $currentlang;
if (in_array(current_language(), array('ja', 'ja_utf8', 'kn_utf8', 'sr_utf8', 'vi_utf8', 'zh_cn', 'zh_tw', 'zh_tw_utf8'))) { // Multibyte languages
if (empty($currentlang)) {
$currentlang = current_language();
}
if (in_array(substr($currentlang,0,2), array('ja', 'kn', 'sr', 'vi', 'zh'))) { // Multibyte languages
return $string;
}
@ -2637,6 +2643,24 @@ function make_table($table) {
return $output;
}
function print_recent_activity_note($time, $user, $isteacher, $text, $link) {
static $strftimerecent;
if (empty($strftimerecent)) {
$strftimerecent = get_string('strftimerecent');
}
$date = userdate($time, $strftimerecent);
$name = fullname($user, $isteacher);
echo '<div class="head">';
echo '<span class="date">'.$date.'</span> - '.
'<span class="name">'.fullname($user, $isteacher).'</span>';
echo '</div>';
echo '<div class="info"><a href="'.$link.'">'.$text.'</a></div>';
}
/**
* Prints a basic textarea field.
*

View File

@ -291,10 +291,10 @@ function assignment_print_recent_activity($course, $isteacher, $timestart) {
$content = false;
$assignments = NULL;
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
"module = 'assignment' AND ".
"action = 'upload' ", "time ASC")) {
if (!$logs = get_records_select('log', 'time > \''.$timestart.'\' AND '.
'course = \''.$course->id.'\' AND '.
'module = \'assignment\' AND '.
'action = \'upload\' ', 'time ASC')) {
return false;
}
@ -314,16 +314,12 @@ function assignment_print_recent_activity($course, $isteacher, $timestart) {
}
if ($assignments) {
$strftimerecent = get_string("strftimerecent");
$content = true;
print_headline(get_string("newsubmissions", "assignment").":");
print_headline(get_string('newsubmissions', 'assignment').':');
foreach ($assignments as $assignment) {
$date = userdate($assignment->time, $strftimerecent);
echo "$date - ".fullname($assignment)."<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/assignment/$assignment->url\">";
echo "$assignment->name";
echo '</a>"';
print_recent_activity_note($assignment->time, $assignment, $isteacher, $assignment->name,
$CFG->wwwroot.'/mod/assignment/'.$assignment->url);
}
$content = true;
}
return $content;

View File

@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 60;
?>

View File

@ -249,15 +249,6 @@ function attendance_user_complete($course, $user, $mod, $attendance) {
return true;
}
function attendance_print_recent_activity($course, $isteacher, $timestart) {
/// Given a course and a time, this module should find recent activity
/// that has occurred in attendance activities and print it out.
/// Return true if there was output, or false is there was none.
global $CFG;
return false; // True if anything was printed, otherwise false
}
function attendance_cron () {
/// Function to be run periodically according to the moodle cron

View File

@ -166,7 +166,7 @@ function chat_print_recent_activity($course, $isteacher, $timestart) {
$timeold = time() - $CFG->chat_old_ping;
$lastpingsearch = ($CFG->chat_method == 'sockets') ? "": "AND cu.lastping > '$timeold'";
$lastpingsearch = ($CFG->chat_method == 'sockets') ? '': 'AND cu.lastping > \''.$timeold.'\'';
if (!$chatusers = get_records_sql("SELECT u.id, cu.chatid, u.firstname, u.lastname
FROM {$CFG->prefix}chat_users as cu,
@ -186,28 +186,33 @@ function chat_print_recent_activity($course, $isteacher, $timestart) {
foreach ($chatusers as $chatuser) {
if ($current != $chatuser->chatid) {
if ($current) {
echo "</p>";
echo '</ul></div>'; // room
$current = 0;
}
if ($chat = get_record("chat", "id", $chatuser->chatid)) {
if ($chat = get_record('chat', 'id', $chatuser->chatid)) {
if (!($isteacher or instance_is_visible('chat', $chat))) { // Chat hidden to students
continue;
}
if (!$outputstarted) {
print_headline(get_string("currentchats", "chat").":");
print_headline(get_string('currentchats', 'chat').':');
$outputstarted = true;
}
echo "<p><font size=\"1\"><a href=\"$CFG->wwwroot/mod/chat/view.php?c=$chat->id\">$chat->name</a></font><br />";
echo '<div class="room"><p class="head"><a href="'.$CFG->wwwroot.'/mod/chat/view.php?c='.$chat->id.'">'.$chat->name.'</a></p><ul>';
}
$current = $chatuser->chatid;
}
$fullname = fullname($chatuser);
echo "&nbsp;&nbsp;&nbsp;<font size=\"1\">- $fullname</font><br />";
$fullname = fullname($chatuser, $isteacher);
echo '<li class="info name">'.$fullname.'</li>';
}
if ($current) {
echo '</ul></div>'; // room
}
echo "<br />";
return true;
}
function chat_cron () {
/// Function to be run periodically according to the moodle cron
/// This function searches for things that need to be done, such

View File

@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600; // The (date) version of this module
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000; // The (date) version of this module
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
?>

View File

@ -4,21 +4,21 @@ $CHOICE_MAX_NUMBER = 6;
$COLUMN_HEIGHT = 300;
define("CHOICE_PUBLISH_ANONYMOUS", "0");
define("CHOICE_PUBLISH_NAMES", "1");
define('CHOICE_PUBLISH_ANONYMOUS', '0');
define('CHOICE_PUBLISH_NAMES', '1');
define("CHOICE_RELEASE_NOT", "0");
define("CHOICE_RELEASE_AFTER_ANSWER", "1");
define("CHOICE_RELEASE_AFTER_CLOSE", "2");
define("CHOICE_RELEASE_ALWAYS", "3");
define('CHOICE_RELEASE_NOT', '0');
define('CHOICE_RELEASE_AFTER_ANSWER', '1');
define('CHOICE_RELEASE_AFTER_CLOSE', '2');
define('CHOICE_RELEASE_ALWAYS', '3');
$CHOICE_PUBLISH = array (CHOICE_PUBLISH_ANONYMOUS => get_string("publishanonymous", "choice"),
CHOICE_PUBLISH_NAMES => get_string("publishnames", "choice"));
$CHOICE_PUBLISH = array (CHOICE_PUBLISH_ANONYMOUS => get_string('publishanonymous', 'choice'),
CHOICE_PUBLISH_NAMES => get_string('publishnames', 'choice'));
$CHOICE_RELEASE = array (CHOICE_RELEASE_NOT => get_string("publishnot", "choice"),
CHOICE_RELEASE_AFTER_ANSWER => get_string("publishafteranswer", "choice"),
CHOICE_RELEASE_AFTER_CLOSE => get_string("publishafterclose", "choice"),
CHOICE_RELEASE_ALWAYS => get_string("publishalways", "choice"));
$CHOICE_RELEASE = array (CHOICE_RELEASE_NOT => get_string('publishnot', 'choice'),
CHOICE_RELEASE_AFTER_ANSWER => get_string('publishafteranswer', 'choice'),
CHOICE_RELEASE_AFTER_CLOSE => get_string('publishafterclose', 'choice'),
CHOICE_RELEASE_ALWAYS => get_string('publishalways', 'choice'));
/// Standard functions /////////////////////////////////////////////////////////

View File

@ -161,19 +161,15 @@ function dialogue_print_recent_activity($course, $isteacher, $timestart) {
}
// if we got some "live" ones then output them
if ($addentrycontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("newdialogueentries", "dialogue").":");
print_headline(get_string('newdialogueentries', 'dialogue').':');
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
$tempmod->course = $course->id;
$tempmod->id = $log->dialogueid;
//Obtain the visible property from the instance
if (instance_is_visible("dialogue",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo '<p><font size="1">'.$date.' - '.fullname($log).'<br />';
echo "\"<a href=\"$CFG->wwwroot/mod/dialogue/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/dialogue/'.str_replace('&', '&amp;', $log->url));
}
}
}
@ -188,66 +184,28 @@ function dialogue_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->course = $course->id;
$tempmod->id = $log->dialogueid;
//Obtain the visible property from the instance
if (instance_is_visible("dialogue",$tempmod)) {
if (instance_is_visible('dialogue',$tempmod)) {
$opencontent = true;
break;
}
}
// if we got some "live" ones then output them
// if we got some 'live' ones then output them
if ($opencontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("opendialogueentries", "dialogue").":");
print_headline(get_string('opendialogueentries', 'dialogue').':');
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
$tempmod->course = $course->id;
$tempmod->id = $log->dialogueid;
//Obtain the visible property from the instance
if (instance_is_visible("dialogue",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo '<p><font size="1">'.$date.' - '.fullname($log).'<br />';
echo "\"<a href=\"$CFG->wwwroot/mod/dialogue/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
if (instance_is_visible('dialogue',$tempmod)) {
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/dialogue/'.str_replace('&', '&amp;', $log->url));
}
}
}
}
// have a look for closed conversations
$closedcontent = false;
if ($logs = dialogue_get_closed_logs($course, $timestart)) {
// got some, see if any belong to a visible module
foreach ($logs as $log) {
// Create a temp valid module structure (only need courseid, moduleid)
$tempmod->course = $course->id;
$tempmod->id = $log->dialogueid;
//Obtain the visible property from the instance
if (instance_is_visible("dialogue",$tempmod)) {
$closedcontent = true;
break;
}
}
// if we got some "live" ones then output them
if ($closedcontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("modulenameplural", "dialogue").":");
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
$tempmod->course = $course->id;
$tempmod->id = $log->dialogueid;
//Obtain the visible property from the instance
if (instance_is_visible("dialogue",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo "<p><font size=1>$date - ".get_string("namehascloseddialogue", "dialogue",
fullname($log))."<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/dialogue/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
}
}
}
}
return $addentrycontent or $closedcontent;
return $addentrycontent or $opencontent;
}

View File

@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 60;
?>

View File

@ -343,31 +343,27 @@ function exercise_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->course = $course->id;
$tempmod->id = $log->exerciseid;
//Obtain the visible property from the instance
if (instance_is_visible("exercise",$tempmod)) {
if (instance_is_visible('exercise',$tempmod)) {
$submitcontent = true;
break;
}
}
// if we got some "live" ones then output them
// if we got some 'live' ones then output them
if ($submitcontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("exercisesubmissions", "exercise").":");
print_headline(get_string('exercisesubmissions', 'exercise').':');
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
$tempmod->course = $course->id;
$tempmod->id = $log->exerciseid;
//Obtain the visible property from the instance
if (instance_is_visible("exercise",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo '<p><font size="1">'.$date.' - '.fullname($log).'<br />';
echo "\"<a href=\"$CFG->wwwroot/mod/exercise/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
}
if (instance_is_visible('exercise',$tempmod)) {
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/exercise/'.str_replace('&', '&amp;', $log->url));
}
}
}
}
}
// have a look for new assessment gradings for this user
$gradecontent = false;
@ -381,27 +377,23 @@ function exercise_print_recent_activity($course, $isteacher, $timestart) {
if (instance_is_visible("exercise",$tempmod)) {
$gradecontent = true;
break;
}
}
}
// if we got some "live" ones then output them
if ($gradecontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("exercisefeedback", "exercise").":");
print_headline(get_string('exercisefeedback', 'exercise').':');
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
$tempmod->course = $course->id;
$tempmod->id = $log->exerciseid;
//Obtain the visible property from the instance
if (instance_is_visible("exercise",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo '<p><font size="1">'.$date.' - '.fullname($log).'<br />';
echo "\"<a href=\"$CFG->wwwroot/mod/exercise/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
}
if (instance_is_visible('exercise',$tempmod)) {
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/exercise/'.str_replace('&', '&amp;', $log->url));
}
}
}
}
// have a look for new assessments for this user
$assesscontent = false;
@ -420,24 +412,20 @@ function exercise_print_recent_activity($course, $isteacher, $timestart) {
}
// if we got some "live" ones then output them
if ($assesscontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("exerciseassessments", "exercise").":");
print_headline(get_string('exerciseassessments', 'exercise').':');
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
$tempmod->course = $course->id;
$tempmod->id = $log->exerciseid;
//Obtain the visible property from the instance
if (instance_is_visible("exercise",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo '<p><font size="1">'.$date.' - '.fullname($log).'<br />';
echo "\"<a href=\"$CFG->wwwroot/mod/exercise/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
}
if (instance_is_visible('exercise',$tempmod)) {
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/exercise/'.str_replace('&', '&amp;', $log->url));
}
}
}
}
}
return $submitcontent or $gradecontent or $assesscontent;
}

View File

@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 60;
?>

View File

@ -732,14 +732,14 @@ function forum_print_recent_activity($course, $isteacher, $timestart) {
$heading = false;
$content = false;
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
"module = 'forum' AND ".
"action LIKE 'add %' ", "time ASC")){
if (!$logs = get_records_select('log', 'time > \''.$timestart.'\' AND '.
'course = \''.$course->id.'\' AND '.
'module = \'forum\' AND '.
'action LIKE \'add %\' ', 'time ASC')){
return false;
}
$strftimerecent = get_string("strftimerecent");
$strftimerecent = get_string('strftimerecent');
$isteacheredit = isteacheredit($course->id);
$mygroupid = mygroupid($course->id);
@ -753,20 +753,18 @@ function forum_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->course = $log->course;
$tempmod->id = $post->forum;
//Obtain the visible property from the instance
$modvisible = instance_is_visible($log->module, $tempmod);
$modvisible = instance_is_visible('forum', $tempmod);
}
//Only if the post exists and mod is visible
if ($post && $modvisible) {
/// Check whether this is for teachers only
$teacheronly = "";
if ($forum = get_record("forum", "id", $post->forum)) {
if ($forum->type == "teacher") {
if ($isteacher) {
$teacheronly = "class=\"teacheronly\"";
} else {
continue;
}
$teacheronly = '';
if ($post->forumtype == 'teacher') {
if ($isteacher) {
$teacheronly = 'class=\'teacheronly\'';
} else {
continue;
}
}
/// Check whether this is belongs to a discussion in a group that
@ -774,10 +772,10 @@ function forum_print_recent_activity($course, $isteacher, $timestart) {
if (!$isteacheredit and $post->groupid != -1) { /// Editing teachers or open discussions
if (!isset($cm[$post->forum])) {
$cm[$forum->id] = get_coursemodule_from_instance("forum", $forum->id, $course->id);
$groupmode[$forum->id] = groupmode($course, $cm[$forum->id]);
$cm[$post->forum] = get_coursemodule_from_instance('forum', $post->forum, $course->id);
$groupmode[$post->forum] = groupmode($course, $cm[$post->forum]);
}
if ($groupmode[$forum->id]) {
if ($groupmode[$post->forum]) {
if ($mygroupid != $post->groupid) {
continue;
}
@ -785,24 +783,24 @@ function forum_print_recent_activity($course, $isteacher, $timestart) {
}
if (! $heading) {
print_headline(get_string("newforumposts", "forum").":");
print_headline(get_string('newforumposts', 'forum').':');
$heading = true;
$content = true;
}
$date = userdate($post->modified, $strftimerecent);
$fullname = fullname($post, $isteacher);
echo "<p $teacheronly><font size=\"1\">$date - $fullname<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/forum/".str_replace('&', '&amp;', $log->url)."\">";
$subjectclass = ($log->action == 'add discussion') ? ' bold' : '';
echo '<div class="head'.$teacheronly.'"><span class="date">';
echo $date.'</span> - <span class="name">'.fullname($post, $isteacher);
echo '</span></div><div class="info'.$subjectclass.'">';
echo '"<a href="'.$CFG->wwwroot.'/mod/forum/'.str_replace('&', '&amp;', $log->url).'">';
$post->subject = break_up_long_words($post->subject);
if (!empty($CFG->filterall)) {
$post->subject = filter_text("<nolink>$post->subject</nolink>", $course->id);
$post->subject = filter_text('<nolink>'.$post->subject.'</nolink>', $course->id);
}
if ($log->action == "add discussion") {
echo "<b>$post->subject</b>";
} else {
echo "$post->subject";
}
echo "</a>\"</font></p>";
echo $post->subject;
echo '</a>"</div>';
}
}
@ -1110,26 +1108,32 @@ function forum_get_post_from_log($log) {
if ($log->action == "add post") {
return get_record_sql("SELECT p.*, d.forum, d.groupid, u.firstname, u.lastname, u.email, u.picture
return get_record_sql("SELECT p.*, f.type AS forumtype, d.forum, d.groupid,
u.firstname, u.lastname, u.email, u.picture
FROM {$CFG->prefix}forum_discussions d,
{$CFG->prefix}forum_posts p,
{$CFG->prefix}forum f,
{$CFG->prefix}user u
WHERE p.id = '$log->info'
AND d.id = p.discussion
AND p.userid = u.id
AND u.deleted <> '1'");
AND u.deleted <> '1'
AND f.id = d.forum");
} else if ($log->action == "add discussion") {
return get_record_sql("SELECT p.*, d.forum, d.groupid, u.firstname, u.lastname, u.email, u.picture
return get_record_sql("SELECT p.*, f.type AS forumtype, d.forum, d.groupid,
u.firstname, u.lastname, u.email, u.picture
FROM {$CFG->prefix}forum_discussions d,
{$CFG->prefix}forum_posts p,
{$CFG->prefix}forum f,
{$CFG->prefix}user u
WHERE d.id = '$log->info'
AND d.firstpost = p.id
AND p.userid = u.id
AND u.deleted <> '1'");
AND u.deleted <> '1'
AND f.id = d.forum");
}
return NULL;
}

View File

@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 60;
?>

View File

@ -236,11 +236,11 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) {
global $CFG;
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
"module = 'glossary' AND ".
"(action = 'add entry' OR ".
" action = 'approve entry')", "time ASC")) {
if (!$logs = get_records_select('log', 'time > \''.$timestart.'\' AND '.
'course = \''.$course->id.'\' AND '.
'module = \'glossary\' AND '.
'(action = \'add entry\' OR '.
' action = \'approve entry\')', 'time ASC')) {
return false;
}
@ -249,7 +249,7 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) {
foreach ($logs as $log) {
//Create a temp valid module structure (course,id)
$tempmod->course = $log->course;
$entry = get_record("glossary_entries","id",$log->info);
$entry = get_record('glossary_entries','id',$log->info);
$tempmod->id = $entry->glossaryid;
//Obtain the visible property from the instance
$modvisible = instance_is_visible($log->module,$tempmod);
@ -264,24 +264,21 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) {
$content = false;
if ($entries) {
$strftimerecent = get_string("strftimerecent");
$content = true;
print_headline(get_string("newentries", "glossary").":");
print_headline(get_string('newentries', 'glossary').':');
foreach ($entries as $entry) {
$date = userdate($entry->timemodified, $strftimerecent);
$user = get_record("user","id",$entry->userid);
$fullname = fullname($user, $isteacher);
echo "<p><font size=\"1\">$date - $fullname<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid&amp;mode=entry&amp;hook=$entry->id\">";
echo "$entry->concept";
echo "</a>\"</font></p>";
$user = get_record('user','id',$entry->userid, '','', '','', 'firstname,lastname');
print_recent_activity_note($entry->timemodified, $user, $isteacher, $entry->concept,
$CFG->wwwroot.'/mod/glossary/view.php?g='.$entry->glossaryid.
'&amp;mode=entry&amp;hook='.$entry->id);
}
}
return $content;
}
function glossary_log_info($log) {
global $CFG;

View File

@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
$release = "1.5 development"; // User-friendly version number

View File

@ -190,10 +190,10 @@ function journal_print_recent_activity($course, $isteacher, $timestart) {
$content = false;
$journals = NULL;
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
"module = 'journal' AND ".
"(action = 'add entry' OR action = 'update entry')", "time ASC")){
if (!$logs = get_records_select('log', 'time > \''.$timestart.'\' AND '.
'course = \''.$course->id.'\' AND '.
'module = \'journal\' AND '.
'(action = \'add entry\' OR action = \'update entry\')', 'time ASC')){
return false;
}
@ -219,14 +219,10 @@ function journal_print_recent_activity($course, $isteacher, $timestart) {
if ($journals) {
$content = true;
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("newjournalentries", "journal").":");
print_headline(get_string('newjournalentries', 'journal').':');
foreach ($journals as $journal) {
$date = userdate($journal->time, $strftimerecent);
echo "<p><font size=\"1\">$date - ".fullname($journal)."<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/journal/$journal->url\">";
echo "$journal->name";
echo "</a>\"</font></p>";
print_recent_activity_note($journal->time, $journal, $isteacher, $journal->name,
$CFG->wwwroot.'/mod/journal/'.$journal->url);
}
}

View File

@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 60;
?>

View File

@ -182,11 +182,7 @@ function scorm_print_recent_activity(&$logs, $isteacher=false) {
/// If isteacher is true then perhaps additional information is printed.
/// This function is called from course/lib.php: print_recent_activity()
global $CFG, $COURSE_TEACHER_COLOR;
$content = NULL;
return $content; // True if anything was printed, otherwise false
return false; // True if anything was printed, otherwise false
}
function scorm_cron () {

View File

@ -138,10 +138,10 @@ function survey_print_recent_activity($course, $isteacher, $timestart) {
$content = false;
$surveys = NULL;
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
"module = 'survey' AND ".
"action = 'submit' ", "time ASC")) {
if (!$logs = get_records_select('log', 'time > \''.$timestart.'\' AND '.
'course = \''.$course->id.'\' AND '.
'module = \'survey\' AND '.
'action = \'submit\' ', 'time ASC')) {
return false;
}
@ -162,14 +162,10 @@ function survey_print_recent_activity($course, $isteacher, $timestart) {
if ($surveys) {
$content = true;
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("newsurveyresponses", "survey").":");
print_headline(get_string('newsurveyresponses', 'survey').':');
foreach ($surveys as $survey) {
$date = userdate($survey->time, $strftimerecent);
echo "<p><font size=\"1\">$date - ".fullname($survey)."<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/survey/$survey->url\">";
echo "$survey->name";
echo "</a>\"</font></p>";
print_recent_activity_note($survey->time, $survey, $isteacher, $survey->name,
$CFG->wwwroot.'/mod/survey/'.$survey->url);
}
}

View File

@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 0;
?>

View File

@ -143,10 +143,10 @@ function wiki_print_recent_activity($course, $isteacher, $timestart) {
/// Return true if there was output, or false is there was none.
global $CFG;
if (!$logs = get_records_select("log", "time > '$timestart' AND ".
"course = '$course->id' AND ".
"module = 'wiki' AND ".
"action LIKE 'edit%' ", "time ASC")){
if (!$logs = get_records_select('log', 'time > \''.$timestart.'\' AND '.
'course = \''.$course->id.'\' AND '.
'module = \'wiki\' AND '.
'action LIKE \'edit%\' ', 'time ASC')){
return false;
}
@ -167,15 +167,11 @@ function wiki_print_recent_activity($course, $isteacher, $timestart) {
}
if ($wikis) {
$strftimerecent = get_string("strftimerecent");
$content = true;
print_headline('Updated wiki page'.":");
print_headline(get_string('updatedwikipages', 'wiki').':', 3);
foreach ($wikis as $wiki) {
$date = userdate($wiki->time, $strftimerecent);
echo $date.' - '.fullname($wiki)."<br />";
echo '"<a href="'.$CFG->wwwroot.'/mod/wiki/'.$wiki->url.'">';
echo $wiki->pagename;
echo '</a>"<br />';
print_recent_activity_note($wiki->time, $wiki, $isteacher, $wiki->pagename,
$CFG->wwwroot.'/mod/wiki/'.$wiki->url);
}
}
return true; // True if anything was printed, otherwise false

View File

@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005022000; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005021600; // The current module version (Date: YYYYMMDDXX)
$module->version = 2005031000; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005031000; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)
?>

View File

@ -9,42 +9,6 @@ require_once($CFG->libdir.'/filelib.php');
/*** Constants **********************************/
$WORKSHOP_TYPE = array (0 => get_string("notgraded", "workshop"),
1 => get_string("accumulative", "workshop"),
2 => get_string("errorbanded", "workshop"),
3 => get_string("criterion", "workshop"),
4 => get_string("rubric", "workshop") );
$WORKSHOP_SHOWGRADES = array (0 => get_string("dontshowgrades", "workshop"),
1 => get_string("showgrades", "workshop") );
$WORKSHOP_SCALES = array(
0 => array( 'name' => get_string("scaleyes", "workshop"), 'type' => 'radio',
'size' => 2, 'start' => get_string("yes"), 'end' => get_string("no")),
1 => array( 'name' => get_string("scalepresent", "workshop"), 'type' => 'radio',
'size' => 2, 'start' => get_string("present", "workshop"),
'end' => get_string("absent", "workshop")),
2 => array( 'name' => get_string("scalecorrect", "workshop"), 'type' => 'radio',
'size' => 2, 'start' => get_string("correct", "workshop"),
'end' => get_string("incorrect", "workshop")),
3 => array( 'name' => get_string("scalegood3", "workshop"), 'type' => 'radio',
'size' => 3, 'start' => get_string("good", "workshop"),
'end' => get_string("poor", "workshop")),
4 => array( 'name' => get_string("scaleexcellent4", "workshop"), 'type' => 'radio',
'size' => 4, 'start' => get_string("excellent", "workshop"),
'end' => get_string("verypoor", "workshop")),
5 => array( 'name' => get_string("scaleexcellent5", "workshop"), 'type' => 'radio',
'size' => 5, 'start' => get_string("excellent", "workshop"),
'end' => get_string("verypoor", "workshop")),
6 => array( 'name' => get_string("scaleexcellent7", "workshop"), 'type' => 'radio',
'size' => 7, 'start' => get_string("excellent", "workshop"),
'end' => get_string("verypoor", "workshop")),
7 => array( 'name' => get_string("scale10", "workshop"), 'type' => 'selection',
'size' => 10),
8 => array( 'name' => get_string("scale20", "workshop"), 'type' => 'selection',
'size' => 20),
9 => array( 'name' => get_string("scale100", "workshop"), 'type' => 'selection',
'size' => 100));
$WORKSHOP_EWEIGHTS = array( 0 => -4.0, 1 => -2.0, 2 => -1.5, 3 => -1.0, 4 => -0.75, 5 => -0.5, 6 => -0.25,
7 => 0.0, 8 => 0.25, 9 => 0.5, 10 => 0.75, 11=> 1.0, 12 => 1.5, 13=> 2.0,
@ -55,11 +19,11 @@ $WORKSHOP_FWEIGHTS = array( 0 => 0, 1 => 0.1, 2 => 0.25, 3 => 0.5, 4 => 0.75, 5
$WORKSHOP_ASSESSMENT_COMPS = array (
0 => array('name' => get_string("verylax", "workshop"), 'value' => 1),
1 => array('name' => get_string("lax", "workshop"), 'value' => 0.6),
2 => array('name' => get_string("fair", "workshop"), 'value' => 0.4),
3 => array('name' => get_string("strict", "workshop"), 'value' => 0.33),
4 => array('name' => get_string("verystrict", "workshop"), 'value' => 0.2) );
0 => array('name' => get_string('verylax', 'workshop'), 'value' => 1),
1 => array('name' => get_string('lax', 'workshop'), 'value' => 0.6),
2 => array('name' => get_string('fair', 'workshop'), 'value' => 0.4),
3 => array('name' => get_string('strict', 'workshop'), 'value' => 0.33),
4 => array('name' => get_string('verystrict', 'workshop'), 'value' => 0.2) );
@ -658,7 +622,6 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
}
// if we got some "live" ones then output them
if ($agreecontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("workshopagreedassessments", "workshop").":");
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
@ -666,21 +629,17 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->id = $log->workshopid;
//Obtain the visible property from the instance
if (instance_is_visible("workshop",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
if (isteacher($course->id, $log->userid)) {
echo "<p><font size=\"1\">$date - ".fullname($log)."<br />";
}
else { // don't break anonymous rule
echo "<p><font size=\"1\">$date - A $course->student<br />";
}
echo "\"<a href=\"$CFG->wwwroot/mod/workshop/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
if (!isteacher($course->id, $log->userid)) { // don't break anonymous rule
$log->firstname = $course->student;
$log->lastname = '';
}
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/workshop/'.$log->url);
}
}
}
}
}
// have a look for new assessments for this user (assess)
$assesscontent = false;
@ -699,7 +658,6 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
}
// if we got some "live" ones then output them
if ($assesscontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("workshopassessments", "workshop").":");
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
@ -707,22 +665,17 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->id = $log->workshopid;
//Obtain the visible property from the instance
if (instance_is_visible("workshop",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
if (isteacher($course->id, $log->userid)) {
echo "<p><font size=\"1\">$date - ".fullname($log)."<br />";
}
else { // don't break anonymous rule
echo "<p><font size=\"1\">$date - A $course->student<br />";
}
echo "\"<a href=\"$CFG->wwwroot/mod/workshop/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
if (!isteacher($course->id, $log->userid)) { // don't break anonymous rule
$log->firstname = $course->student;
$log->lastname = '';
}
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/workshop/'.$log->url);
}
}
}
}
}
// have a look for new comments for this user (comment)
$commentcontent = false;
if (!$isteacher) { // teachers only need to see submissions
@ -740,7 +693,6 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
}
// if we got some "live" ones then output them
if ($commentcontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("workshopcomments", "workshop").":");
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
@ -748,16 +700,15 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->id = $log->workshopid;
//Obtain the visible property from the instance
if (instance_is_visible("workshop",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo "<p><font size=\"1\">$date - A $course->student<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/workshop/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
}
$log->firstname = $course->student; // Keep anonymous
$log->lastname = '';
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/workshop/'.$log->url);
}
}
}
}
}
// have a look for new assessment gradings for this user (grade)
$gradecontent = false;
@ -775,7 +726,6 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
}
// if we got some "live" ones then output them
if ($gradecontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("workshopfeedback", "workshop").":");
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
@ -783,15 +733,14 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->id = $log->workshopid;
//Obtain the visible property from the instance
if (instance_is_visible("workshop",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo "<p><font size=\"1\">$date - $course->teacher<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/workshop/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
}
$log->firstname = $course->teacher; // Keep anonymous
$log->lastname = '';
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/workshop/'.$log->url);
}
}
}
}
// have a look for new submissions (only show to teachers) (submit)
$submitcontent = false;
@ -810,7 +759,6 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
}
// if we got some "live" ones then output them
if ($submitcontent) {
$strftimerecent = get_string("strftimerecent");
print_headline(get_string("workshopsubmissions", "workshop").":");
foreach ($logs as $log) {
//Create a temp valid module structure (only need courseid, moduleid)
@ -818,16 +766,13 @@ function workshop_print_recent_activity($course, $isteacher, $timestart) {
$tempmod->id = $log->workshopid;
//Obtain the visible property from the instance
if (instance_is_visible("workshop",$tempmod)) {
$date = userdate($log->time, $strftimerecent);
echo "<p><font size=\"1\">$date - ".fullname($log)."<br />";
echo "\"<a href=\"$CFG->wwwroot/mod/workshop/".str_replace('&', '&amp;', $log->url)."\">";
echo "$log->name";
echo "</a>\"</font></p>";
}
print_recent_activity_note($log->time, $log, $isteacher, $log->name,
$CFG->wwwroot.'/mod/workshop/'.$log->url);
}
}
}
}
}
return $agreecontent or $assesscontent or $commentcontent or $gradecontent or $submitcontent;
}

View File

@ -2,6 +2,44 @@
/// Library of extra functions and module workshop
$WORKSHOP_TYPE = array (0 => get_string('notgraded', 'workshop'),
1 => get_string('accumulative', 'workshop'),
2 => get_string('errorbanded', 'workshop'),
3 => get_string('criterion', 'workshop'),
4 => get_string('rubric', 'workshop') );
$WORKSHOP_SHOWGRADES = array (0 => get_string('dontshowgrades', 'workshop'),
1 => get_string('showgrades', 'workshop') );
$WORKSHOP_SCALES = array(
0 => array( 'name' => get_string('scaleyes', 'workshop'), 'type' => 'radio',
'size' => 2, 'start' => get_string('yes'), 'end' => get_string('no')),
1 => array( 'name' => get_string('scalepresent', 'workshop'), 'type' => 'radio',
'size' => 2, 'start' => get_string('present', 'workshop'),
'end' => get_string('absent', 'workshop')),
2 => array( 'name' => get_string('scalecorrect', 'workshop'), 'type' => 'radio',
'size' => 2, 'start' => get_string('correct', 'workshop'),
'end' => get_string('incorrect', 'workshop')),
3 => array( 'name' => get_string('scalegood3', 'workshop'), 'type' => 'radio',
'size' => 3, 'start' => get_string('good', 'workshop'),
'end' => get_string('poor', 'workshop')),
4 => array( 'name' => get_string('scaleexcellent4', 'workshop'), 'type' => 'radio',
'size' => 4, 'start' => get_string('excellent', 'workshop'),
'end' => get_string('verypoor', 'workshop')),
5 => array( 'name' => get_string('scaleexcellent5', 'workshop'), 'type' => 'radio',
'size' => 5, 'start' => get_string('excellent', 'workshop'),
'end' => get_string('verypoor', 'workshop')),
6 => array( 'name' => get_string('scaleexcellent7', 'workshop'), 'type' => 'radio',
'size' => 7, 'start' => get_string('excellent', 'workshop'),
'end' => get_string('verypoor', 'workshop')),
7 => array( 'name' => get_string('scale10', 'workshop'), 'type' => 'selection',
'size' => 10),
8 => array( 'name' => get_string('scale20', 'workshop'), 'type' => 'selection',
'size' => 20),
9 => array( 'name' => get_string('scale100', 'workshop'), 'type' => 'selection',
'size' => 100));
//////////////////////////////////////////////////////////////////////////////////////
/*** Functions for the workshop module ******
@ -2596,7 +2634,6 @@ function workshop_print_assignment_info($workshop) {
error("Course Module ID was incorrect");
}
// print standard assignment heading
print_simple_box_start("center");
print_heading($workshop->name, "center");
print_simple_box_start("center");
@ -2632,11 +2669,7 @@ function workshop_print_assignment_info($workshop) {
}
echo ")<br />";
print_simple_box_end();
echo "<br />";
echo format_text($workshop->summary, $workshop->format);
print_simple_box_end();
echo "<br />";
}
}
//////////////////////////////////////////////////////////////////////////////////////

View File

@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005021600;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->cron = 60;
?>

View File

@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2005030501; // YYYYMMDD = date
$version = 2005031000; // YYYYMMDD = date
// XY = increments within a single day
$release = '1.5 UNSTABLE DEVELOPMENT'; // Human-friendly version name