From: Petr Skoda Date: Sun, 1 Nov 2009 13:17:47 +0000 (+0000) Subject: MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trail... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e7521559ed921af0597811de54473b62ea1e7d5e;p=moodle.git MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup --- diff --git a/calendar/event.php b/calendar/event.php index 87deb6d5ec..95183df398 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -657,5 +657,3 @@ function calendar_add_event_allowed($event) { return false; } } - -?> diff --git a/calendar/export.php b/calendar/export.php index 19b81fb57f..e6f7983bef 100644 --- a/calendar/export.php +++ b/calendar/export.php @@ -197,7 +197,3 @@ echo ''; echo ''; echo $OUTPUT->footer(); - - - -?> diff --git a/calendar/export_execute.php b/calendar/export_execute.php index 40d72cdb59..f0bee0c28b 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -1,4 +1,4 @@ -dirroot.'/course/lib.php'); @@ -168,5 +168,3 @@ header('Content-length: '.strlen($serialized)); header('Content-type: text/calendar'); echo $serialized; - -?> diff --git a/calendar/lib.php b/calendar/lib.php index 310c23b625..e1f66bf74b 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -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); } -?> diff --git a/calendar/view.php b/calendar/view.php index e3ce44bb52..2dfa38af58 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -655,5 +655,3 @@ function calendar_course_filter_selector($getvars = '') { $select->nothinglabel = false; return $OUTPUT->select($select); } - -?> diff --git a/mod/assignment/backuplib.php b/mod/assignment/backuplib.php index 581e496b2c..c4d670c77d 100644 --- a/mod/assignment/backuplib.php +++ b/mod/assignment/backuplib.php @@ -1,15 +1,15 @@ -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)); } -?> + diff --git a/mod/assignment/db/access.php b/mod/assignment/db/access.php index 2e970129a4..83df79296c 100644 --- a/mod/assignment/db/access.php +++ b/mod/assignment/db/access.php @@ -80,4 +80,4 @@ $mod_assignment_capabilities = array( ), ); -?> + diff --git a/mod/assignment/db/install.php b/mod/assignment/db/install.php index eaefbd8b40..b8e9a7bad3 100644 --- a/mod/assignment/db/install.php +++ b/mod/assignment/db/install.php @@ -1,4 +1,4 @@ - + diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 5c757972e1..0584d17bd4 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -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 = '
'.$button.'
'; @@ -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) { diff --git a/mod/assignment/mod_form.php b/mod/assignment/mod_form.php index cd1d663676..00e104512b 100644 --- a/mod/assignment/mod_form.php +++ b/mod/assignment/mod_form.php @@ -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); diff --git a/mod/assignment/restorelib.php b/mod/assignment/restorelib.php index b02ed66cf4..ba364f3444 100644 --- a/mod/assignment/restorelib.php +++ b/mod/assignment/restorelib.php @@ -1,15 +1,15 @@ -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 "
  • ".get_string("modulename","assignment")." \"".format_string($assignment->name,true)."\"
  • "; } @@ -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; } -?> + diff --git a/mod/assignment/settings.php b/mod/assignment/settings.php index cdf7effac5..9db9cdf5a4 100644 --- a/mod/assignment/settings.php +++ b/mod/assignment/settings.php @@ -1,4 +1,4 @@ -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)); -?> + diff --git a/mod/assignment/simpletest/test_assignment_portfolio_callers.php b/mod/assignment/simpletest/test_assignment_portfolio_callers.php index f97bfb8b00..f980e203ad 100644 --- a/mod/assignment/simpletest/test_assignment_portfolio_callers.php +++ b/mod/assignment/simpletest/test_assignment_portfolio_callers.php @@ -1,4 +1,4 @@ -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(); } } -?> + diff --git a/mod/assignment/type/offline/assignment.class.php b/mod/assignment/type/offline/assignment.class.php index 671ace4287..a7c4309eda 100644 --- a/mod/assignment/type/offline/assignment.class.php +++ b/mod/assignment/type/offline/assignment.class.php @@ -1,4 +1,4 @@ - + diff --git a/mod/assignment/type/online/all.php b/mod/assignment/type/online/all.php index c7ebb24a29..f69ec0ef18 100644 --- a/mod/assignment/type/online/all.php +++ b/mod/assignment/type/online/all.php @@ -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'); diff --git a/mod/assignment/type/online/assignment.class.php b/mod/assignment/type/online/assignment.class.php index f9d82b4658..9ad6dca5d0 100644 --- a/mod/assignment/type/online/assignment.class.php +++ b/mod/assignment/type/online/assignment.class.php @@ -1,4 +1,4 @@ -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 = '
    '. '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 = '
    '. 'html'. @@ -346,4 +346,4 @@ class mod_assignment_online_edit_form extends moodleform { } } -?> + diff --git a/mod/assignment/type/online/version.php b/mod/assignment/type/online/version.php index ceba567deb..b047325978 100644 --- a/mod/assignment/type/online/version.php +++ b/mod/assignment/type/online/version.php @@ -1,4 +1,4 @@ -version = 2005042900; $plugin->requires = 2007101000; -?> + diff --git a/mod/assignment/type/upload/assignment.class.php b/mod/assignment/type/upload/assignment.class.php index 02ffac8df0..df8f611f73 100644 --- a/mod/assignment/type/upload/assignment.class.php +++ b/mod/assignment/type/upload/assignment.class.php @@ -1,4 +1,4 @@ -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 .= ' '; } @@ -1150,4 +1150,4 @@ class mod_assignment_upload_response_form extends moodleform { -?> + diff --git a/mod/assignment/type/uploadsingle/assignment.class.php b/mod/assignment/type/uploadsingle/assignment.class.php index b026732889..fde72dd976 100644 --- a/mod/assignment/type/uploadsingle/assignment.class.php +++ b/mod/assignment/type/uploadsingle/assignment.class.php @@ -1,4 +1,4 @@ - + diff --git a/mod/assignment/version.php b/mod/assignment/version.php index 6ea4d55d97..7c3351cba5 100644 --- a/mod/assignment/version.php +++ b/mod/assignment/version.php @@ -1,4 +1,4 @@ -version = 2009062500; $module->requires = 2009041700; // Requires this Moodle version $module->cron = 60; -?> + diff --git a/mod/chat/README.txt b/mod/chat/README.txt index 23bf016278..d495677cca 100644 --- a/mod/chat/README.txt +++ b/mod/chat/README.txt @@ -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): diff --git a/mod/chat/backuplib.php b/mod/chat/backuplib.php index 6465af9762..b1174b9d74 100644 --- a/mod/chat/backuplib.php +++ b/mod/chat/backuplib.php @@ -1,15 +1,15 @@ -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)); } -?> + diff --git a/mod/chat/chatd.php b/mod/chat/chatd.php index c64ce54957..d6fc4f53d7 100755 --- a/mod/chat/chatd.php +++ b/mod/chat/chatd.php @@ -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"); -?> + diff --git a/mod/chat/db/access.php b/mod/chat/db/access.php index f34243f41e..e68ca6a528 100644 --- a/mod/chat/db/access.php +++ b/mod/chat/db/access.php @@ -100,4 +100,4 @@ $mod_chat_capabilities = array( ); -?> + diff --git a/mod/chat/db/install.php b/mod/chat/db/install.php index 212e1d741b..db920e2811 100644 --- a/mod/chat/db/install.php +++ b/mod/chat/db/install.php @@ -1,4 +1,4 @@ - + diff --git a/mod/chat/gui_ajax/index.php b/mod/chat/gui_ajax/index.php index 7d69560d17..4a75cec527 100644 --- a/mod/chat/gui_ajax/index.php +++ b/mod/chat/gui_ajax/index.php @@ -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; echo $OUTPUT->footer(); -?> + diff --git a/mod/chat/gui_ajax/script.js b/mod/chat/gui_ajax/script.js index a0c848e7ec..7885baba78 100644 --- a/mod/chat/gui_ajax/script.js +++ b/mod/chat/gui_ajax/script.js @@ -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(); } } diff --git a/mod/chat/gui_basic/index.php b/mod/chat/gui_basic/index.php index c2d6649d1f..38f8f6cb15 100644 --- a/mod/chat/gui_basic/index.php +++ b/mod/chat/gui_basic/index.php @@ -193,4 +193,3 @@ if (empty($allmessages)) { echo '
    '; echo $OUTPUT->footer(); -?> \ No newline at end of file diff --git a/mod/chat/gui_header_js/jsupdate.php b/mod/chat/gui_header_js/jsupdate.php index f10b33a5e1..a7df3425ca 100644 --- a/mod/chat/gui_header_js/jsupdate.php +++ b/mod/chat/gui_header_js/jsupdate.php @@ -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) " : ""; diff --git a/mod/chat/gui_header_js/jsupdated.php b/mod/chat/gui_header_js/jsupdated.php index f8e251d38c..c83827f27b 100644 --- a/mod/chat/gui_header_js/jsupdated.php +++ b/mod/chat/gui_header_js/jsupdated.php @@ -1,15 +1,15 @@ - ** + ** ** 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 '' . "\n\n"; diff --git a/mod/chat/gui_header_js/users.php b/mod/chat/gui_header_js/users.php index 0485c8d1c9..cf8555c57b 100644 --- a/mod/chat/gui_header_js/users.php +++ b/mod/chat/gui_header_js/users.php @@ -124,4 +124,3 @@ if ($CFG->chat_refresh_userlist < 15) { exit; // no further output -?> \ No newline at end of file diff --git a/mod/chat/gui_sockets/chatinput.php b/mod/chat/gui_sockets/chatinput.php index cdb1f9421b..c772ca3ba2 100644 --- a/mod/chat/gui_sockets/chatinput.php +++ b/mod/chat/gui_sockets/chatinput.php @@ -31,7 +31,7 @@ echo $OUTPUT->header(); help_icon(moodle_help_icon::make("chatting", get_string("helpchatting", "chat"), "chat", true)); ?> - +
    chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform"> diff --git a/mod/chat/index.php b/mod/chat/index.php index 44e52f438e..f83b9225ec 100644 --- a/mod/chat/index.php +++ b/mod/chat/index.php @@ -88,4 +88,4 @@ echo $OUTPUT->table($table); echo $OUTPUT->footer(); -?> + diff --git a/mod/chat/lib.php b/mod/chat/lib.php index a2090cabdb..cd93a43a96 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -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 { diff --git a/mod/chat/report.php b/mod/chat/report.php index b830c86277..cd3081d26f 100644 --- a/mod/chat/report.php +++ b/mod/chat/report.php @@ -250,4 +250,4 @@ /// Finish the page echo $OUTPUT->footer(); -?> + diff --git a/mod/chat/restorelib.php b/mod/chat/restorelib.php index 217d4862be..562d0a8d1c 100644 --- a/mod/chat/restorelib.php +++ b/mod/chat/restorelib.php @@ -1,15 +1,15 @@ -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 "
  • ".get_string("modulename","chat")." \"".format_string($chat->name,true)."\"
  • "; } @@ -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; } -?> + diff --git a/mod/chat/settings.php b/mod/chat/settings.php index 46f8b6d7d9..fa11c0769f 100644 --- a/mod/chat/settings.php +++ b/mod/chat/settings.php @@ -1,4 +1,4 @@ -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)); -?> + diff --git a/mod/chat/simpletest/test_chat_portfolio_callers.php b/mod/chat/simpletest/test_chat_portfolio_callers.php index c08cc29be3..f43a99a6b8 100644 --- a/mod/chat/simpletest/test_chat_portfolio_callers.php +++ b/mod/chat/simpletest/test_chat_portfolio_callers.php @@ -1,4 +1,4 @@ -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(); } } -?> + diff --git a/mod/chat/version.php b/mod/chat/version.php index 9cbda2e14c..870b86ea10 100644 --- a/mod/chat/version.php +++ b/mod/chat/version.php @@ -1,4 +1,4 @@ -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)? -?> + diff --git a/mod/chat/view.php b/mod/chat/view.php index d69d9efb0d..4888de15ac 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -1,4 +1,4 @@ -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 '

    '; if ($CFG->enableajax) { @@ -194,4 +194,4 @@ echo $OUTPUT->footer(); -?> +