echo '</tr></table>';
echo $OUTPUT->footer();
-
-
-
-?>
-<?php // $Id$
+<?php
require_once('../config.php');
//require_once($CFG->dirroot.'/course/lib.php');
header('Content-type: text/calendar');
echo $serialized;
-
-?>
calendar_get_allowed_types($allowed);
return (bool)($allowed->user || $allowed->groups || $allowed->courses || $allowed->site);
}
-?>
$select->nothinglabel = false;
return $OUTPUT->select($select);
}
-
-?>
-<?php //$Id$
+<?php
//This php script contains all the stuff to backup/restore
//assignment mods
//This is the "graphical" structure of the assignment mod:
//
// assignment
- // (CL,pk->id)
+ // (CL,pk->id)
// |
// |
// |
- // assignment_submisions
+ // assignment_submisions
// (UL,pk->id, fk->assignment,files)
//
// Meaning: pk->primary key field of the table
}
}
}
- return $status;
+ return $status;
}
function assignment_backup_one_mod($bf,$preferences,$assignment) {
global $CFG, $DB;
-
+
if (is_numeric($assignment)) {
$assignment = $DB->get_record('assignment', array('id'=>$assignment));
}
-
+
$status = true;
//Start mod
//Start submission
$status =fwrite ($bf,start_tag("SUBMISSION",5,true));
//Print submission contents
- fwrite ($bf,full_tag("ID",6,false,$ass_sub->id));
- fwrite ($bf,full_tag("USERID",6,false,$ass_sub->userid));
- fwrite ($bf,full_tag("TIMECREATED",6,false,$ass_sub->timecreated));
- fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$ass_sub->timemodified));
- fwrite ($bf,full_tag("NUMFILES",6,false,$ass_sub->numfiles));
- fwrite ($bf,full_tag("DATA1",6,false,$ass_sub->data1));
- fwrite ($bf,full_tag("DATA2",6,false,$ass_sub->data2));
- fwrite ($bf,full_tag("GRADE",6,false,$ass_sub->grade));
- fwrite ($bf,full_tag("SUBMISSIONCOMMENT",6,false,$ass_sub->submissioncomment));
- fwrite ($bf,full_tag("FORMAT",6,false,$ass_sub->format));
- fwrite ($bf,full_tag("TEACHER",6,false,$ass_sub->teacher));
- fwrite ($bf,full_tag("TIMEMARKED",6,false,$ass_sub->timemarked));
- fwrite ($bf,full_tag("MAILED",6,false,$ass_sub->mailed));
+ fwrite ($bf,full_tag("ID",6,false,$ass_sub->id));
+ fwrite ($bf,full_tag("USERID",6,false,$ass_sub->userid));
+ fwrite ($bf,full_tag("TIMECREATED",6,false,$ass_sub->timecreated));
+ fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$ass_sub->timemodified));
+ fwrite ($bf,full_tag("NUMFILES",6,false,$ass_sub->numfiles));
+ fwrite ($bf,full_tag("DATA1",6,false,$ass_sub->data1));
+ fwrite ($bf,full_tag("DATA2",6,false,$ass_sub->data2));
+ fwrite ($bf,full_tag("GRADE",6,false,$ass_sub->grade));
+ fwrite ($bf,full_tag("SUBMISSIONCOMMENT",6,false,$ass_sub->submissioncomment));
+ fwrite ($bf,full_tag("FORMAT",6,false,$ass_sub->format));
+ fwrite ($bf,full_tag("TEACHER",6,false,$ass_sub->teacher));
+ fwrite ($bf,full_tag("TIMEMARKED",6,false,$ass_sub->timemarked));
+ fwrite ($bf,full_tag("MAILED",6,false,$ass_sub->mailed));
$class = 'assignment_' . $assignment->assignmenttype;
require_once($CFG->dirroot . '/mod/assignment/lib.php');
//and files are user info's level
function backup_assignment_files($bf,$preferences) {
global $CFG, $DB;
-
+
$status = true;
//First we check to moddata exists and create it as necessary
return $status;
- }
+ }
function backup_assignment_files_instance($bf,$preferences,$instanceid) {
global $CFG, $DB;
-
+
$status = true;
//First we check to moddata exists and create it as necessary
return $status;
- }
+ }
//Return an array of info (name,value)
function assignment_check_backup_mods($course,$user_data=false,$backup_unique_code,$instances=null) {
//Now, if requested, the user_data
if ($user_data) {
$info[1][0] = get_string("submissions","assignment");
- if ($ids = assignment_submission_ids_by_course ($course)) {
+ if ($ids = assignment_submission_ids_by_course ($course)) {
$info[1][1] = count($ids);
} else {
$info[1][1] = 0;
// INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
- //Returns an array of assignments id
+ //Returns an array of assignments id
function assignment_ids ($course) {
global $CFG, $DB;
FROM {assignment} a
WHERE a.course = ?", array($course));
}
-
+
//Returns an array of assignment_submissions id
function assignment_submission_ids_by_course ($course) {
global $CFG, $DB;
FROM {assignment_submissions} s
WHERE s.assignment = ?", array($instanceid));
}
-?>
+
-<?php //$Id$
+<?php
// This file replaces:
// * STATEMENTS section in db/install.xml
-<?php //$Id$
+<?php
// This file keeps track of upgrades to
// the assignment module
return $result;
}
-?>
+
/**
* Standard base class for all assignment submodules (assignment types).
- *
+ *
* @package mod-assignment
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
$url = new moodle_url('/mod/assignment/submissions.php', array(
'id' => $this->cm->id,
'userid' => $submission->userid,
- 'mode' => 'single',
+ 'mode' => 'single',
'offset' => (optional_param('offset', '', PARAM_INT)-1)));
-
+
$link = html_link::make($url, $buttontext);
$link->add_action(new popup_action('click', $link->url, 'grade'.$submission->userid, array('height' => 450, 'width' => 700)));
$link->title = $buttontext;
- $button = $OUTPUT->link($link);
-
+ $button = $OUTPUT->link($link);
+
$output.= 'opener.document.getElementById("up'.$submission->userid.'").innerHTML="'.addslashes_js($button).'";';
}
$link = html_link::make($popup_url, $buttontext);
$link->add_action(new popup_action('click', $link->url, 'grade'.$auser->id, array('height' => 600, 'width' => 700)));
$link->title = $buttontext;
- $button = $OUTPUT->link($link);
+ $button = $OUTPUT->link($link);
$status = '<div id="up'.$auser->id.'" class="s'.$auser->status.'">'.$button.'</div>';
*/
function assignment_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedownload) {
global $CFG, $DB;
-
+
if (!$assignment = $DB->get_record('assignment', array('id'=>$cminfo->instance))) {
return false;
}
$types[$name] = get_string('type'.$name, 'assignment');
// ugly hack to support pluggable assignment type titles..
- if ($types[$name] == '[[type'.$name.']]') {
+ if ($types[$name] == '[[type'.$name.']]') {
$types[$name] = get_string('type'.$name, 'assignment_'.$name);
- }
+ }
}
asort($types);
return $types;
$strreviewed = get_string('reviewed','assignment');
- // NOTE: we do all possible database work here *outside* of the loop to ensure this scales
+ // NOTE: we do all possible database work here *outside* of the loop to ensure this scales
//
list($sqlassignmentids, $assignmentidparams) = $DB->get_in_or_equal($assignmentids);
-
+
// build up and array of unmarked submissions indexed by assigment id/ userid
// for use where the user has grading rights on assigment
- $rs = $DB->get_recordset_sql("SELECT id, assignment, userid
+ $rs = $DB->get_recordset_sql("SELECT id, assignment, userid
FROM {assignment_submissions}
WHERE teacher = 0 AND timemarked = 0
AND assignment $sqlassignmentids", $assignmentidparams);
// get all user submissions, indexed by assigment id
$mysubmissions = $DB->get_records_sql("SELECT assignment, timemarked, teacher, grade
FROM {assignment_submissions}
- WHERE userid = ? AND
+ WHERE userid = ? AND
assignment $sqlassignmentids", array_merge(array($USER->id), $assignmentidparams));
foreach ($assignments as $assignment) {
// hack to support pluggable assignment type titles
if ($typetitle === '[[type'.$type.']]') {
$typetitle = get_string('type'.$type, 'assignment_'.$type);
- }
+ }
$mform->addElement('header', 'typedesc', $typetitle);
-<?php //$Id$
+<?php
//This php script contains all the stuff to backup/restore
//assignment mods
//This is the "graphical" structure of the assignment mod:
//
// assignment
- // (CL,pk->id)
+ // (CL,pk->id)
// |
// |
// |
- // assignment_submisions
+ // assignment_submisions
// (UL,pk->id, fk->assignment,files)
//
// Meaning: pk->primary key field of the table
//We have to recode the grade field if it is <0 (scale)
if ($assignment->grade < 0) {
- $scale = backup_getid($restore->backup_unique_code,"scale",abs($assignment->grade));
+ $scale = backup_getid($restore->backup_unique_code,"scale",abs($assignment->grade));
if ($scale) {
- $assignment->grade = -($scale->new_id);
+ $assignment->grade = -($scale->new_id);
}
}
//The structure is equal to the db, so insert the assignment
$newid = $DB->insert_record ("assignment",$assignment);
- //Do some output
+ //Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>".get_string("modulename","assignment")." \"".format_string($assignment->name,true)."\"</li>";
}
call_user_func(array($class, 'restore_one_mod'), $info, $restore, $assignment);
//Now check if want to restore user data and do it.
- if (restore_userdata_selected($restore,'assignment',$mod->id)) {
+ if (restore_userdata_selected($restore,'assignment',$mod->id)) {
//Restore assignmet_submissions
$status = assignment_submissions_restore_mods($mod->id, $newid,$info,$restore) && $status;
$status = assignment_submissions_restore_mods($mod->id, $newid,$info,$restore, $assignment) && $status;
$submission->submissioncomment = backup_todb($sub_info['#']['COMMENT']['0']['#']);
} else {
$submission->submissioncomment = backup_todb($sub_info['#']['SUBMISSIONCOMMENT']['0']['#']);
- }
+ }
$submission->format = backup_todb($sub_info['#']['FORMAT']['0']['#']);
$submission->teacher = backup_todb($sub_info['#']['TEACHER']['0']['#']);
$submission->timemarked = backup_todb($sub_info['#']['TIMEMARKED']['0']['#']);
$user = backup_getid($restore->backup_unique_code,"user",$submission->teacher);
if ($user) {
$submission->teacher = $user->new_id;
- }
+ }
//The structure is equal to the db, so insert the assignment_submission
$newid = $DB->insert_record ("assignment_submissions",$submission);
$newid);
//Now copy moddata associated files
- $status = assignment_restore_files ($old_assignment_id, $new_assignment_id,
+ $status = assignment_restore_files ($old_assignment_id, $new_assignment_id,
$olduserid, $submission->userid, $restore);
$submission->id = $newid;
}
//This function copies the assignment related info from backup temp dir to course moddata folder,
- //creating it if needed and recoding everything (assignment id and user id)
+ //creating it if needed and recoding everything (assignment id and user id)
function assignment_restore_files ($oldassid, $newassid, $olduserid, $newuserid, $restore) {
global $CFG;
//Now, locate course's moddata directory
$moddata_path = $CFG->dataroot."/".$restore->course_id."/".$CFG->moddata;
-
+
//Check it exists and create it
$status = check_dir_exists($moddata_path,true);
//Now this user id
$user_assignment_path = $this_assignment_path."/".$newuserid;
//And now, copy temp_path to user_assignment_path
- $status = backup_copy_file($temp_path, $user_assignment_path);
+ $status = backup_copy_file($temp_path, $user_assignment_path);
}
-
+
return $status;
}
//assignment_decode_content_links_caller() function in each module
//in the restore process
function assignment_decode_content_links ($content,$restore) {
-
+
global $CFG;
-
+
$result = $content;
-
+
//Link to the list of assignments
-
+
$searchstring='/\$@(ASSIGNMENTINDEX)\*([0-9]+)@\$/';
//We look for it
preg_match_all($searchstring,$content,$foundset);
if($rec->new_id) {
//Now replace it
$result= preg_replace($searchstring,$CFG->wwwroot.'/mod/assignment/index.php?id='.$rec->new_id,$result);
- } else {
+ } else {
//It's a foreign link so leave it as original
$result= preg_replace($searchstring,$restore->original_wwwroot.'/mod/assignment/index.php?id='.$old_id,$result);
}
//This function returns a log record with all the necessay transformations
//done. It's used by restore_log_module() to restore modules log.
function assignment_restore_logs($restore,$log) {
-
+
$status = false;
-
+
//Depending of the action, we recode different things
switch ($log->action) {
case "add":
break;
case "update grades":
if ($log->cmid) {
- //Extract the assignment id from the url field
+ //Extract the assignment id from the url field
$assid = substr(strrchr($log->url,"="),1);
//Get the new_id of the module (to recode the info field)
$mod = backup_getid($restore->backup_unique_code,$log->module,$assid);
}
return $status;
}
-?>
+
-<?php //$Id$
+<?php
require_once($CFG->dirroot.'/mod/assignment/lib.php');
$settings->add(new admin_setting_configcheckbox('assignment_showrecentsubmissions', get_string('showrecentsubmissions', 'assignment'),
get_string('configshowrecentsubmissions', 'assignment'), 1));
-?>
+
-<?php // $Id$
+<?php
require_once("$CFG->libdir/simpletest/portfolio_testclass.php");
require_once("$CFG->dirroot/mod/assignment/lib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.php");
parent::test_caller_with_plugins();
}
}
-?>
+
-<?php // $Id$
+<?php
/**
* Extend the base assignment class for offline assignments
}
-?>
+
// all.php
//
// Displays a complete list of online assignments
-// for the course. Rather like what happened in
+// for the course. Rather like what happened in
// the old Journal activity.
// Howard Miller 2008
// See MDL-14045
require_capability('mod/assignment:view',$context);
// various strings
-$str = new stdClass;
+$str = new stdClass;
$str->assignments = get_string("modulenameplural", "assignment");
$str->duedate = get_string('duedate','assignment');
$str->duedateno = get_string('duedateno','assignment');
-<?php // $Id$
+<?php
require_once($CFG->libdir.'/formslib.php');
require_once($CFG->dirroot . '/mod/assignment/lib.php');
/**
if (!$submission = $this->get_submission($userid)) {
return '';
}
-
+
$link = html_link::make("/mod/assignment/type/online/file.php?id={$this->cm->id}&userid={$submission->userid}", shorten_text(trim(strip_tags(format_text($submission->data1,$submission->data2))), 15));
$link->add_action(new popup_action('click', $link->url, 'file'.$userid, array('height' => 450, 'width' => 580)));
$link->title = get_string('submission', 'assignment');
- $popup = $OUTPUT->link($link);
-
+ $popup = $OUTPUT->link($link);
+
$output = '<div class="files">'.
'<img src="'.$OUTPUT->old_icon_url('f/html') . '" class="icon" alt="html" />'.
$popup .
if (!$submission = $this->get_submission($userid)) {
return '';
}
-
+
$link = html_link::make("/mod/assignment/type/online/file.php?id={$this->cm->id}&userid={$submission->userid}", shorten_text(trim(strip_tags(format_text($submission->data1,$submission->data2))), 15));
$link->add_action(new popup_action('click', $link->url, 'file'.$userid, array('height' => 450, 'width' => 580)));
$link->title = get_string('submission', 'assignment');
- $popup = $OUTPUT->link($link);
+ $popup = $OUTPUT->link($link);
$output = '<div class="files">'.
'<img align="middle" src="'.$OUTPUT->old_icon_url('f/html') . '" height="16" width="16" alt="html" />'.
}
}
-?>
+
-<?PHP // $Id$
+<?php
////////////////////////////////////////////////////////////////////////////////
// Code fragment to define the module version etc.
$plugin->version = 2005042900;
$plugin->requires = 2007101000;
-?>
+
-<?php // $Id$
+<?php
require_once($CFG->libdir . '/portfoliolib.php');
require_once($CFG->dirroot . '/mod/assignment/lib.php');
$link = html_link::make("/mod/assignment/type/upload/notes.php?id=$this->cm->id&userid=$userid", get_string('notes', 'assignment'));
$link->add_action(new popup_action('click', $link->url, 'notes', array('height' => 500, 'width' => 780)));
$link->title = get_string('notes', 'assignment');
- $output .= $OUTPUT->link($link);
-
+ $output .= $OUTPUT->link($link);
+
$output .= ' ';
}
-?>
+
-<?php // $Id$
+<?php
/**
* Extend the base assignment class for assignments where you upload a single file
}
}
-?>
+
-<?PHP // $Id$
+<?php
////////////////////////////////////////////////////////////////////////////////
// Code fragment to define the module version etc.
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 60;
-?>
+
Official Chat Module for Moodle
------------------------------
-The chat module now supports a backend daemon for
+The chat module now supports a backend daemon for
more efficiency.
-It's still buggy and being worked on, but if you
+It's still buggy and being worked on, but if you
want to test it and help out here are some quick
instructions:
1) Admin -> Config -> Modules -> Chat -> Settings
-2) Set the method to "sockets" and set up the ports etc
+2) Set the method to "sockets" and set up the ports etc
3) Start the server like this (from the Unix command line):
-<?php //$Id$
+<?php
//This php script contains all the stuff to backup/restore
//chat mods
//This is the "graphical" structure of the chat mod:
//
// chat
- // (CL,pk->id)
+ // (CL,pk->id)
// |
// |
// |
- // chat_messages
+ // chat_messages
// (UL,pk->id, fk->chatid)
//
// Meaning: pk->primary key field of the table
}
}
}
- return $status;
+ return $status;
}
function chat_backup_one_mod($bf,$preferences,$chat) {
global $CFG, $DB;
-
+
if (is_numeric($chat)) {
$chat = $DB->get_record('chat', array('id'=>$chat));
}
-
+
$status = true;
//Start mod
//Start message
$status =fwrite ($bf,start_tag("MESSAGE",5,true));
//Print message contents
- fwrite ($bf,full_tag("ID",6,false,$cha_mes->id));
- fwrite ($bf,full_tag("USERID",6,false,$cha_mes->userid));
- fwrite ($bf,full_tag("GROUPID",6,false,$cha_mes->groupid));
- fwrite ($bf,full_tag("SYSTEM",6,false,$cha_mes->system));
- fwrite ($bf,full_tag("MESSAGE_TEXT",6,false,$cha_mes->message));
- fwrite ($bf,full_tag("TIMESTAMP",6,false,$cha_mes->timestamp));
+ fwrite ($bf,full_tag("ID",6,false,$cha_mes->id));
+ fwrite ($bf,full_tag("USERID",6,false,$cha_mes->userid));
+ fwrite ($bf,full_tag("GROUPID",6,false,$cha_mes->groupid));
+ fwrite ($bf,full_tag("SYSTEM",6,false,$cha_mes->system));
+ fwrite ($bf,full_tag("MESSAGE_TEXT",6,false,$cha_mes->message));
+ fwrite ($bf,full_tag("TIMESTAMP",6,false,$cha_mes->timestamp));
//End submission
$status =fwrite ($bf,end_tag("MESSAGE",5,true));
}
//Now, if requested, the user_data
if ($user_data) {
$info[1][0] = get_string("messages","chat");
- if ($ids = chat_message_ids_by_course ($course)) {
+ if ($ids = chat_message_ids_by_course ($course)) {
$info[1][1] = count($ids);
} else {
$info[1][1] = 0;
//Now, if requested, the user_data
if (!empty($instance->userdata)) {
$info[$instance->id.'1'][0] = get_string("messages","chat");
- if ($ids = chat_message_ids_by_instance ($instance->id)) {
+ if ($ids = chat_message_ids_by_instance ($instance->id)) {
$info[$instance->id.'1'][1] = count($ids);
} else {
$info[$instance->id.'1'][1] = 0;
// INTERNAL FUNCTIONS. BASED IN THE MOD STRUCTURE
- //Returns an array of chats id
+ //Returns an array of chats id
function chat_ids ($course) {
global $DB;
FROM {chat} c
WHERE c.course = ?", array($course));
}
-
+
//Returns an array of assignment_submissions id
function chat_message_ids_by_course ($course) {
global $DB;
FROM {chat_messages} m
WHERE m.chatid = ?", array($instanceid));
}
-?>
+
define('CHAT_SIDEKICK_BEEP', 0x23);
$phpversion = phpversion();
-echo 'Moodle chat daemon v1.0 on PHP '.$phpversion." (\$Id$)\n\n";
+echo 'Moodle chat daemon v1.0 on PHP '.$phpversion."\n\n";
/// Set up all the variables we need /////////////////////////////////////
@socket_shutdown($DAEMON->listen_socket, 0);
die("\n\n-- terminated --\n");
-?>
+
-<?php //$Id$
+<?php
// This file replaces:
// * STATEMENTS section in db/install.xml
-<?php //$Id$
+<?php
// This file keeps track of upgrades to
// the chat module
return $result;
}
-?>
+
}
$str_title = format_string($course->shortname) . ": ".format_string($chat->name,true).$groupname;
-$str_send = get_string('send', 'chat');
-$str_themes = get_string('themes');
+$str_send = get_string('send', 'chat');
+$str_themes = get_string('themes');
$PAGE->set_generaltype('popup');
$PAGE->set_title('Chat');
<div id="chat-notify"></div>
DIVS;
echo $OUTPUT->footer();
-?>
+
list.appendChild(item);
if (!row) {
var anim = new YAHOO.util.ColorAnim(item.id, YAHOO.moodle.chat.oddmsg_cfg);
- //anim.animate();
+ //anim.animate();
}
if (msg.mymessage) {
//var anim = new YAHOO.util.ColorAnim(item.id, YAHOO.moodle.chat.mymsg_cfg);
- //anim.animate();
+ //anim.animate();
}
}
echo '</div></div>';
echo $OUTPUT->footer();
-?>
\ No newline at end of file
$timenow = time();
-$params = array('groupid'=>$chatuser->groupid, 'chatid'=>$chatuser->chatid, 'lasttime'=>$chat_lasttime);
+$params = array('groupid'=>$chatuser->groupid, 'chatid'=>$chatuser->chatid, 'lasttime'=>$chat_lasttime);
$groupselect = $chatuser->groupid ? " AND (groupid=:groupid OR groupid=0) " : "";
<?php
/** jsupdated.php - notes by Martin Langhoff <martin@catalyst.net.nz>
- **
+ **
** This is an alternative version of jsupdate.php that acts
** as a long-running daemon. It will feed/stall/feed JS updates
** to the client. From the module configuration select "Stream"
** updates.
- **
- ** The client connection is not forever though. Once we reach
- ** CHAT_MAX_CLIENT_UPDATES, it will force the client to re-fetch it.
- **
+ **
+ ** The client connection is not forever though. Once we reach
+ ** CHAT_MAX_CLIENT_UPDATES, it will force the client to re-fetch it.
+ **
** This buys us all the benefits that chatd has, minus the setup,
** as we are using apache to do the daemon handling.
**
// Ensure the HTML head makes it out there
echo $CHAT_DUMMY_DATA;
- @ob_end_flush();
+ @ob_end_flush();
+
+ for ($n=0; $n <= CHAT_MAX_CLIENT_UPDATES; $n++) {
- for ($n=0; $n <= CHAT_MAX_CLIENT_UPDATES; $n++) {
-
// ping first so we can later shortcut as needed.
$chatuser->lastping = time();
$DB->set_field('chat_users', 'lastping', $chatuser->lastping, array('id'=>$chatuser->id));
}
$timenow = time();
-
+
$params = array('groupid'=>$chatuser->groupid, 'lastid'=>$chat_lastid, 'lasttime'=>$chat_lasttime, 'chatid'=>$chatuser->chatid);
$groupselect = $chatuser->groupid ? " AND (groupid=:groupid OR groupid=0) " : "";
}
$newcriteria = "timestamp > :lasttime";
}
-
+
$messages = $DB->get_records_select("chat_messages_current",
"chatid = :chatid AND $newcriteria $groupselect", $params,
"timestamp ASC");
-
+
if ($messages) {
$num = count($messages);
} else {
}
print '<script type="text/javascript">' . "\n";
- print "//<![CDATA[\n\n";
+ print "//<![CDATA[\n\n";
$chat_newrow = ($chat_lastrow + $num) % 2;
if (($chat_lasttime != $chat_newlasttime) and $messages) {
$beep = false;
- $refreshusers = false;
+ $refreshusers = false;
foreach ($messages as $message) {
$chat_lastrow = ($chat_lastrow + 1) % 2;
$formatmessage = chat_format_message($message, $chatuser->course, $USER, $chat_lastrow);
$chat_lasttime = $message->timestamp;
$chat_lastid = $message->id;
}
-
+
if ($refreshusers) {
echo "if (parent.users.document.anchors[0] != null) {" .
"parent.users.location.href = parent.users.document.anchors[0].href;}\n";
print $CHAT_DUMMY_DATA;
@ob_end_flush();
sleep($CFG->chat_refresh_room);
- } // here ends the for() loop
+ } // here ends the for() loop
// here & should be written & :-D
- $refreshurl = "{$CFG->wwwroot}/mod/chat/gui_header_js/jsupdated.php?chat_sid=$chat_sid&chat_lasttime=$chat_lasttime&chat_lastrow=$chat_newrow&chat_lastid=$chat_lastid";
+ $refreshurl = "{$CFG->wwwroot}/mod/chat/gui_header_js/jsupdated.php?chat_sid=$chat_sid&chat_lasttime=$chat_lasttime&chat_lastrow=$chat_newrow&chat_lastid=$chat_lastid";
print '<script type="text/javascript">' . "\n";
- print "//<![CDATA[ \n\n";
+ print "//<![CDATA[ \n\n";
print "location.href = '$refreshurl';\n";
print "//]]>\n";
print '</script>' . "\n\n";
exit; // no further output
-?>
\ No newline at end of file
<input type="text" name="chat_message" id="chat_message" size="60" value="" />
<?php echo $OUTPUT->help_icon(moodle_help_icon::make("chatting", get_string("helpchatting", "chat"), "chat", true)); ?>
</form>
-
+
<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">
<input type="hidden" name="win" value="message" />
<input type="hidden" name="chat_message" value="" />
echo $OUTPUT->footer();
-?>
+
$groupingjoin = '';
}
- return $DB->get_records_sql("SELECT
- DISTINCT u.id, u.firstname, u.lastname, u.picture, c.lastmessageping, c.firstping, u.imagealt
- FROM {chat_users} c JOIN {user} u ON u.id = c.userid $groupingjoin
+ return $DB->get_records_sql("SELECT
+ DISTINCT u.id, u.firstname, u.lastname, u.picture, c.lastmessageping, c.firstping, u.imagealt
+ FROM {chat_users} c JOIN {user} u ON u.id = c.userid $groupingjoin
WHERE c.chatid = :chatid $groupselect
ORDER BY c.firstping ASC", $params);
}
$groupselect = "";
}
- $sql = "SELECT *
+ $sql = "SELECT *
FROM {chat_messages_current} WHERE chatid = :chatid $groupselect
ORDER BY timestamp DESC";
|| ($this->participated
&& has_capability('mod/chat:exportparticipatedsession', $context));
}
-
+
/**
* @todo Document this function
*/
}
$links = array();
-
+
if (!empty($USER->screenreader)) {
$links[] = html_link::make(new moodle_url($target.'gui_basic/index.php', $params), $strenterchat);
} else {
/// Finish the page
echo $OUTPUT->footer();
-?>
+
-<?php //$Id$
+<?php
//This php script contains all the stuff to backup/restore
//chat mods
//This is the "graphical" structure of the chat mod:
//
// chat
- // (CL,pk->id)
+ // (CL,pk->id)
// |
// |
// |
- // chat_messages
+ // chat_messages
// (UL,pk->id, fk->chatid)
//
// Meaning: pk->primary key field of the table
$data = backup_getid($restore->backup_unique_code,$mod->modtype,$mod->id);
if ($data) {
- //Now get completed xmlized object
+ //Now get completed xmlized object
$info = $data->info;
//traverse_xmlize($info); //Debug
//The structure is equal to the db, so insert the chat
$newid = $DB->insert_record ("chat",$chat);
- //Do some output
+ //Do some output
if (!defined('RESTORE_SILENTLY')) {
echo "<li>".get_string("modulename","chat")." \"".format_string($chat->name,true)."\"</li>";
}
$status = true;
- //Get the messages array
+ //Get the messages array
$messages = $info['MOD']['#']['MESSAGES']['0']['#']['MESSAGE'];
//Iterate over messages
//chat_decode_content_links_caller() function in each module
//in the restore process
function chat_decode_content_links ($content,$restore) {
-
+
global $CFG;
-
+
$result = $content;
-
+
//Link to the list of chats
-
+
$searchstring='/\$@(CHATINDEX)\*([0-9]+)@\$/';
//We look for it
preg_match_all($searchstring,$content,$foundset);
if($rec->new_id) {
//Now replace it
$result= preg_replace($searchstring,$CFG->wwwroot.'/mod/chat/index.php?id='.$rec->new_id,$result);
- } else {
+ } else {
//It's a foreign link so leave it as original
$result= preg_replace($searchstring,$restore->original_wwwroot.'/mod/chat/index.php?id='.$old_id,$result);
}
function chat_decode_content_links_caller($restore) {
global $CFG, $DB;
$status = true;
-
+
if ($chats = $DB->get_records('chat', array('course'=>$restore->course_id), '', "id,intro")) {
//Iterate over each chat->intro
$i = 0; //Counter to send some output to the browser to avoid timeouts
}
return $status;
}
-?>
+
-<?php //$Id$
+<?php
$settings->add(new admin_setting_heading('chat_method_heading', get_string('generalconfig', 'chat'),
get_string('explaingeneralconfig', 'chat')));
$settings->add(new admin_setting_configtext('chat_servermax', get_string('servermax', 'chat'),
get_string('configservermax', 'chat'), 100, PARAM_INT));
-?>
+
-<?php // $Id$
+<?php
require_once("$CFG->libdir/simpletest/portfolio_testclass.php");
require_once("$CFG->dirroot/mod/chat/lib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.php");
parent::test_caller_with_plugins();
}
}
-?>
+
-<?php // $Id$
+<?php
/////////////////////////////////////////////////////////////////////////////////
/// Code fragment to define the version of chat
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
-?>
+
-<?php // $Id$
+<?php
/// This page prints a particular instance of chat
$link = html_link::make($chattarget, $strenterchat);
$link->add_action(new popup_action('click', $link->url, "chat$course->id$chat->id$groupparam", array('height' => 500, 'width' => 700)));
$link->title = get_string('modulename', 'chat');
- echo $OUTPUT->link($link);
-
+ echo $OUTPUT->link($link);
+
echo '</p>';
if ($CFG->enableajax) {
echo $OUTPUT->footer();
-?>
+