MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup

This commit is contained in:
Petr Skoda 2009-11-01 13:17:47 +00:00
parent dfede59d62
commit e7521559ed
42 changed files with 175 additions and 188 deletions

View File

@ -657,5 +657,3 @@ function calendar_add_event_allowed($event) {
return false;
}
}
?>

View File

@ -197,7 +197,3 @@ echo '</td>';
echo '</tr></table>';
echo $OUTPUT->footer();
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once('../config.php');
//require_once($CFG->dirroot.'/course/lib.php');
@ -168,5 +168,3 @@ header('Content-length: '.strlen($serialized));
header('Content-type: text/calendar');
echo $serialized;
?>

View File

@ -1595,4 +1595,3 @@ function calendar_user_can_add_event() {
calendar_get_allowed_types($allowed);
return (bool)($allowed->user || $allowed->groups || $allowed->courses || $allowed->site);
}
?>

View File

@ -655,5 +655,3 @@ function calendar_course_filter_selector($getvars = '') {
$select->nothinglabel = false;
return $OUTPUT->select($select);
}
?>

View File

@ -1,15 +1,15 @@
<?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
@ -37,16 +37,16 @@
}
}
}
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
@ -107,19 +107,19 @@
//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');
@ -138,7 +138,7 @@
//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
@ -155,11 +155,11 @@
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
@ -177,7 +177,7 @@
return $status;
}
}
//Return an array of info (name,value)
function assignment_check_backup_mods($course,$user_data=false,$backup_unique_code,$instances=null) {
@ -199,7 +199,7 @@
//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;
@ -243,7 +243,7 @@
// 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;
@ -251,7 +251,7 @@
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;
@ -271,4 +271,4 @@
FROM {assignment_submissions} s
WHERE s.assignment = ?", array($instanceid));
}
?>

View File

@ -80,4 +80,4 @@ $mod_assignment_capabilities = array(
),
);
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
// This file replaces:
// * STATEMENTS section in db/install.xml

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
// This file keeps track of upgrades to
// the assignment module
@ -161,4 +161,4 @@ function xmldb_assignment_upgrade($oldversion) {
return $result;
}
?>

View File

@ -39,7 +39,7 @@ DEFINE ('ASSIGNMENT_COUNT_LETTERS', 2);
/**
* 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
@ -764,14 +764,14 @@ class assignment_base {
$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).'";';
}
@ -1358,7 +1358,7 @@ class assignment_base {
$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>';
@ -2544,7 +2544,7 @@ function assignment_get_participants($assignmentid) {
*/
function assignment_pluginfile($course, $cminfo, $context, $filearea, $args, $forcedownload) {
global $CFG, $DB;
if (!$assignment = $DB->get_record('assignment', array('id'=>$cminfo->instance))) {
return false;
}
@ -3077,9 +3077,9 @@ function assignment_types() {
$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;
@ -3130,13 +3130,13 @@ function assignment_print_overview($courses, &$htmlarray) {
$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);
@ -3151,7 +3151,7 @@ function assignment_print_overview($courses, &$htmlarray) {
// 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) {

View File

@ -63,7 +63,7 @@ class mod_assignment_mod_form extends moodleform_mod {
// hack to support pluggable assignment type titles
if ($typetitle === '[[type'.$type.']]') {
$typetitle = get_string('type'.$type, 'assignment_'.$type);
}
}
$mform->addElement('header', 'typedesc', $typetitle);

View File

@ -1,15 +1,15 @@
<?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
@ -64,9 +64,9 @@
//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);
}
}
@ -94,7 +94,7 @@
//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>";
}
@ -112,7 +112,7 @@
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;
@ -164,7 +164,7 @@
$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']['#']);
@ -180,7 +180,7 @@
$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);
@ -202,7 +202,7 @@
$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;
@ -219,7 +219,7 @@
}
//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;
@ -237,7 +237,7 @@
//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);
@ -266,9 +266,9 @@
//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;
}
@ -277,13 +277,13 @@
//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);
@ -300,7 +300,7 @@
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);
}
@ -420,9 +420,9 @@
//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":
@ -486,7 +486,7 @@
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);
@ -508,4 +508,4 @@
}
return $status;
}
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
require_once($CFG->dirroot.'/mod/assignment/lib.php');
@ -15,4 +15,4 @@ $settings->add(new admin_setting_configselect('assignment_itemstocount', get_str
$settings->add(new admin_setting_configcheckbox('assignment_showrecentsubmissions', get_string('showrecentsubmissions', 'assignment'),
get_string('configshowrecentsubmissions', 'assignment'), 1));
?>

View File

@ -1,4 +1,4 @@
<?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");
@ -52,4 +52,4 @@ class testAssignmentPortfolioCallers extends portfoliolib_test {
parent::test_caller_with_plugins();
}
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* Extend the base assignment class for offline assignments
@ -100,4 +100,4 @@ class assignment_offline extends assignment_base {
}
?>

View File

@ -4,7 +4,7 @@
// 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
@ -31,7 +31,7 @@ $context = get_context_instance(CONTEXT_COURSE,$course->id);
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');

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once($CFG->libdir.'/formslib.php');
require_once($CFG->dirroot . '/mod/assignment/lib.php');
/**
@ -186,12 +186,12 @@ class assignment_online extends assignment_base {
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 .
@ -205,11 +205,11 @@ class assignment_online extends assignment_base {
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" />'.
@ -346,4 +346,4 @@ class mod_assignment_online_edit_form extends moodleform {
}
}
?>

View File

@ -1,4 +1,4 @@
<?PHP // $Id$
<?php
////////////////////////////////////////////////////////////////////////////////
// Code fragment to define the module version etc.
@ -8,4 +8,4 @@
$plugin->version = 2005042900;
$plugin->requires = 2007101000;
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once($CFG->libdir . '/portfoliolib.php');
require_once($CFG->dirroot . '/mod/assignment/lib.php');
@ -275,8 +275,8 @@ class assignment_upload extends assignment_base {
$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 .= '&nbsp;';
}
@ -1150,4 +1150,4 @@ class mod_assignment_upload_response_form extends moodleform {
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* Extend the base assignment class for assignments where you upload a single file
@ -221,4 +221,4 @@ class assignment_uploadsingle extends assignment_base {
}
}
?>

View File

@ -1,4 +1,4 @@
<?PHP // $Id$
<?php
////////////////////////////////////////////////////////////////////////////////
// Code fragment to define the module version etc.
@ -9,4 +9,4 @@ $module->version = 2009062500;
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 60;
?>

View File

@ -1,16 +1,16 @@
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):

View File

@ -1,15 +1,15 @@
<?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
@ -36,16 +36,16 @@
}
}
}
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
@ -86,12 +86,12 @@
//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));
}
@ -122,7 +122,7 @@
//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;
@ -140,7 +140,7 @@
//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;
@ -170,7 +170,7 @@
// 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;
@ -178,7 +178,7 @@
FROM {chat} c
WHERE c.course = ?", array($course));
}
//Returns an array of assignment_submissions id
function chat_message_ids_by_course ($course) {
global $DB;
@ -197,4 +197,4 @@
FROM {chat_messages} m
WHERE m.chatid = ?", array($instanceid));
}
?>

View File

@ -17,7 +17,7 @@ define('CHAT_SIDEKICK_MESSAGE', 0x22);
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 /////////////////////////////////////
@ -1071,4 +1071,4 @@ while(true) {
@socket_shutdown($DAEMON->listen_socket, 0);
die("\n\n-- terminated --\n");
?>

View File

@ -100,4 +100,4 @@ $mod_chat_capabilities = array(
);
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
// This file replaces:
// * STATEMENTS section in db/install.xml

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
// This file keeps track of upgrades to
// the chat module
@ -87,4 +87,4 @@ function xmldb_chat_upgrade($oldversion) {
return $result;
}
?>

View File

@ -53,8 +53,8 @@ if (!$chat_sid = chat_login_user($chat->id, 'ajax', $groupid, $course)) {
}
$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');
@ -132,4 +132,4 @@ echo <<<DIVS
<div id="chat-notify"></div>
DIVS;
echo $OUTPUT->footer();
?>

View File

@ -213,11 +213,11 @@ YAHOO.moodle.chat.append_msg = function(key, msg, row) {
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();
}
}

View File

@ -193,4 +193,3 @@ if (empty($allmessages)) {
echo '</div></div>';
echo $OUTPUT->footer();
?>

View File

@ -55,7 +55,7 @@ if ($chat_lasttime == 0) { //display some previous messages
$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) " : "";

View File

@ -1,15 +1,15 @@
<?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.
**
@ -117,10 +117,10 @@ foreach ($CFG->stylesheets as $stylesheet) {
// 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));
@ -139,7 +139,7 @@ foreach ($CFG->stylesheets as $stylesheet) {
}
$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) " : "";
@ -152,11 +152,11 @@ foreach ($CFG->stylesheets as $stylesheet) {
}
$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 {
@ -169,7 +169,7 @@ foreach ($CFG->stylesheets as $stylesheet) {
}
print '<script type="text/javascript">' . "\n";
print "//<![CDATA[\n\n";
print "//<![CDATA[\n\n";
$chat_newrow = ($chat_lastrow + $num) % 2;
@ -178,7 +178,7 @@ foreach ($CFG->stylesheets as $stylesheet) {
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);
@ -197,7 +197,7 @@ foreach ($CFG->stylesheets as $stylesheet) {
$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";
@ -229,12 +229,12 @@ EOD;
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";

View File

@ -124,4 +124,3 @@ if ($CFG->chat_refresh_userlist < 15) {
exit; // no further output
?>

View File

@ -31,7 +31,7 @@ echo $OUTPUT->header();
<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="" />

View File

@ -88,4 +88,4 @@ echo $OUTPUT->table($table);
echo $OUTPUT->footer();
?>

View File

@ -539,9 +539,9 @@ function chat_get_users($chatid, $groupid=0, $groupingid=0) {
$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);
}
@ -563,7 +563,7 @@ function chat_get_latest_message($chatid, $groupid=0) {
$groupselect = "";
}
$sql = "SELECT *
$sql = "SELECT *
FROM {chat_messages_current} WHERE chatid = :chatid $groupselect
ORDER BY timestamp DESC";
@ -1302,7 +1302,7 @@ class chat_portfolio_caller extends portfolio_module_caller_base {
|| ($this->participated
&& has_capability('mod/chat:exportparticipatedsession', $context));
}
/**
* @todo Document this function
*/
@ -1381,7 +1381,7 @@ function chat_extend_navigation($navigation, $course, $module, $cm) {
}
$links = array();
if (!empty($USER->screenreader)) {
$links[] = html_link::make(new moodle_url($target.'gui_basic/index.php', $params), $strenterchat);
} else {

View File

@ -250,4 +250,4 @@
/// Finish the page
echo $OUTPUT->footer();
?>

View File

@ -1,15 +1,15 @@
<?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
@ -31,7 +31,7 @@
$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
@ -54,7 +54,7 @@
//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>";
}
@ -85,7 +85,7 @@
$status = true;
//Get the messages array
//Get the messages array
$messages = $info['MOD']['#']['MESSAGES']['0']['#']['MESSAGE'];
//Iterate over messages
@ -142,13 +142,13 @@
//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);
@ -165,7 +165,7 @@
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);
}
@ -208,7 +208,7 @@
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
@ -321,4 +321,4 @@
}
return $status;
}
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
$settings->add(new admin_setting_heading('chat_method_heading', get_string('generalconfig', 'chat'),
get_string('explaingeneralconfig', 'chat')));
@ -44,4 +44,4 @@ $settings->add(new admin_setting_configtext('chat_serverport', get_string('serve
$settings->add(new admin_setting_configtext('chat_servermax', get_string('servermax', 'chat'),
get_string('configservermax', 'chat'), 100, PARAM_INT));
?>

View File

@ -1,4 +1,4 @@
<?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");
@ -43,4 +43,4 @@ class testChatPortfolioCallers extends portfoliolib_test {
parent::test_caller_with_plugins();
}
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/////////////////////////////////////////////////////////////////////////////////
/// Code fragment to define the version of chat
@ -9,4 +9,4 @@ $module->version = 2009042000; // The (date) version of this module
$module->requires = 2009041700; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/// This page prints a particular instance of chat
@ -126,8 +126,8 @@
$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) {
@ -194,4 +194,4 @@
echo $OUTPUT->footer();
?>