MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trail...
authorPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 13:17:47 +0000 (13:17 +0000)
committerPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 13:17:47 +0000 (13:17 +0000)
42 files changed:
calendar/event.php
calendar/export.php
calendar/export_execute.php
calendar/lib.php
calendar/view.php
mod/assignment/backuplib.php
mod/assignment/db/access.php
mod/assignment/db/install.php
mod/assignment/db/upgrade.php
mod/assignment/lib.php
mod/assignment/mod_form.php
mod/assignment/restorelib.php
mod/assignment/settings.php
mod/assignment/simpletest/test_assignment_portfolio_callers.php
mod/assignment/type/offline/assignment.class.php
mod/assignment/type/online/all.php
mod/assignment/type/online/assignment.class.php
mod/assignment/type/online/version.php
mod/assignment/type/upload/assignment.class.php
mod/assignment/type/uploadsingle/assignment.class.php
mod/assignment/version.php
mod/chat/README.txt
mod/chat/backuplib.php
mod/chat/chatd.php
mod/chat/db/access.php
mod/chat/db/install.php
mod/chat/db/upgrade.php
mod/chat/gui_ajax/index.php
mod/chat/gui_ajax/script.js
mod/chat/gui_basic/index.php
mod/chat/gui_header_js/jsupdate.php
mod/chat/gui_header_js/jsupdated.php
mod/chat/gui_header_js/users.php
mod/chat/gui_sockets/chatinput.php
mod/chat/index.php
mod/chat/lib.php
mod/chat/report.php
mod/chat/restorelib.php
mod/chat/settings.php
mod/chat/simpletest/test_chat_portfolio_callers.php
mod/chat/version.php
mod/chat/view.php

index 87deb6d..95183df 100644 (file)
@@ -657,5 +657,3 @@ function calendar_add_event_allowed($event) {
             return false;
     }
 }
-
-?>
index 19b81fb..e6f7983 100644 (file)
@@ -197,7 +197,3 @@ echo '</td>';
 echo '</tr></table>';
 
 echo $OUTPUT->footer();
-
-
-
-?>
index 40d72cd..f0bee0c 100644 (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;
-
-?>
index 310c23b..e1f66bf 100644 (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);
 }
-?>
index e3ce44b..2dfa38a 100644 (file)
@@ -655,5 +655,3 @@ function calendar_course_filter_selector($getvars = '') {
     $select->nothinglabel = false;
     return $OUTPUT->select($select);
 }
-
-?>
index 581e496..c4d670c 100644 (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
                 }
             }
         }
-        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));
     }
-?>
+
index 2e97012..83df792 100644 (file)
@@ -80,4 +80,4 @@ $mod_assignment_capabilities = array(
     ),
 );
 
-?>
+
index eaefbd8..b8e9a7b 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 // This file replaces:
 //   * STATEMENTS section in db/install.xml
index 7a807ae..dc2bfc0 100644 (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;
 }
 
-?>
+
index 5c75797..0584d17 100644 (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) {
index cd1d663..00e1045 100644 (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);
 
index b02ed66..ba364f3 100644 (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>";
             }
                 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;
     }
-?>
+
index cdf7eff..9db9cdf 100644 (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));
 
-?>
+
index f97bfb8..f980e20 100644 (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();
     }
 }
-?>
+
index 671ace4..a7c4309 100644 (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 {
 
 }
 
-?>
+
index c7ebb24..f69ec0e 100644 (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');
index f9d82b4..9ad6dca 100644 (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 {
     }
 }
 
-?>
+
index ceba567..b047325 100644 (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;
 
-?>
+
index 02ffac8..df8f611 100644 (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 {
 
 
 
-?>
+
index b026732..fde72dd 100644 (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 {
     }
 }
 
-?>
+
index 6ea4d55..7c3351c 100644 (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;
 
-?>
+
index 23bf016..d495677 100644 (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):
 
index 6465af9..b1174b9 100644 (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
                 }
             }
         }
-        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));
     }
-?>
+
index c64ce54..d6fc4f5 100755 (executable)
@@ -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");
 
-?>
+
index f34243f..e68ca6a 100644 (file)
@@ -100,4 +100,4 @@ $mod_chat_capabilities = array(
 
 );
 
-?>
+
index 212e1d7..db920e2 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 // This file replaces:
 //   * STATEMENTS section in db/install.xml
index 9666dc7..dd1b40e 100644 (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;
 }
 
-?>
+
index 7d69560..4a75cec 100644 (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();
-?>
+
index a0c848e..7885bab 100644 (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();
     }
 }
 
index c2d6649..38f8f6c 100644 (file)
@@ -193,4 +193,3 @@ if (empty($allmessages)) {
 echo '</div></div>';
 echo $OUTPUT->footer();
 
-?>
\ No newline at end of file
index f10b33a..a7df342 100644 (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) " : "";
 
index f8e251d..c83827f 100644 (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";
index 0485c8d..cf8555c 100644 (file)
@@ -124,4 +124,3 @@ if ($CFG->chat_refresh_userlist < 15) {
 
 exit; // no further output
 
-?>
\ No newline at end of file
index cdb1f94..c772ca3 100644 (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="" />
index 44e52f4..f83b922 100644 (file)
@@ -88,4 +88,4 @@ echo $OUTPUT->table($table);
 
 echo $OUTPUT->footer();
 
-?>
+
index a2090ca..cd93a43 100644 (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 {
index b830c86..cd3081d 100644 (file)
 /// Finish the page
     echo $OUTPUT->footer();
 
-?>
+
index 217d486..562d0a8 100644 (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
     //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;
     }
-?>
+
index 46f8b6d..fa11c07 100644 (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));
 
-?>
+
index c08cc29..f43a99a 100644 (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();
     }
 }
-?>
+
index 9cbda2e..870b86e 100644 (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)?
 
-?>
+
index d69d9ef..4888de1 100644 (file)
@@ -1,4 +1,4 @@
-<?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();
 
-?>
+