Skip to content

Commit

Permalink
MDL-20700 coding style cleanup - cvs keywords removed, closign php ta…
Browse files Browse the repository at this point in the history
…g removed, trailing whitespace cleanup
  • Loading branch information
skodak committed Nov 4, 2009
1 parent cb8a83b commit aeb1553
Show file tree
Hide file tree
Showing 136 changed files with 923 additions and 937 deletions.
22 changes: 11 additions & 11 deletions mod/quiz/report/default.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php // $Id$
<?php // $Id$

////////////////////////////////////////////////////////////////////
/// Default class for report plugins
///
/// Doesn't do anything on it's own -- it needs to be extended.
/// This class displays quiz reports. Because it is called from
/// Default class for report plugins
///
/// Doesn't do anything on it's own -- it needs to be extended.
/// This class displays quiz reports. Because it is called from
/// within /mod/quiz/report.php you can assume that the page header
/// and footer are taken care of.
///
/// This file can refer to itself as report.php to pass variables
/// to itself - all these will also be globally available. You must
///
/// This file can refer to itself as report.php to pass variables
/// to itself - all these will also be globally available. You must
/// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname".
////////////////////////////////////////////////////////////////////

Expand All @@ -30,17 +30,17 @@ function print_header_and_tabs($cm, $course, $quiz, $reportmode="overview") {
$PAGE->set_title(format_string($quiz->name));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'quiz'));
echo $OUTPUT->header();
/// Print the tabs
/// Print the tabs
$currenttab = 'reports';
$mode = $reportmode;
require($CFG->dirroot . '/mod/quiz/tabs.php');
$course_context = get_context_instance(CONTEXT_COURSE, $course->id);
if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
. get_string('seeallcoursegrades', 'grades') . '</a></div>';
}

}
}

?>

12 changes: 6 additions & 6 deletions mod/quiz/report/grading/report.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* Quiz report to help teachers manually grade quiz questions that need it.
*
Expand Down Expand Up @@ -128,13 +128,13 @@ function display($quiz, $cm, $course) {
"quiz=?", array_merge(array($uniqueid), $params, array($quiz->id)))){
print_error('invalidattemptid', 'quiz_grading');
}

// Load the state for this attempt (The questions array was created earlier)
$states = get_question_states($questions, $quiz, $attempt);
// The $states array is indexed by question id but because we are dealing
// with only one question there is only one entry in this array
$state = &$states[$question->id];

// the following will update the state and attempt
$error = question_process_comment($question, $state, $attempt, $response['comment'], $response['grade']);
if (is_string($error)) {
Expand Down Expand Up @@ -205,7 +205,7 @@ function display($quiz, $cm, $course) {

// our 2 different views

// the first view allows a user to select a question and
// the first view allows a user to select a question and
// displays the users who have answered the essay question
// and all of their attempts at answering the question

Expand Down Expand Up @@ -456,7 +456,7 @@ function attempts_sql($quizid, $wantstateevent=false, $questionid=0, $userid=0,
$where = "WHERE u.id $usql ";
$params = array_merge($params, $u_params);
}

$where .= ' AND qs.event IN ('.QUESTION_EVENTS_CLOSED_OR_GRADED.')';

$where .= ' AND u.id = qa.userid AND qa.quiz = ?';
Expand All @@ -471,4 +471,4 @@ function attempts_sql($quizid, $wantstateevent=false, $questionid=0, $userid=0,

}

?>

4 changes: 2 additions & 2 deletions mod/quiz/report/overview/db/upgrade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php

function xmldb_quiz_overview_upgrade($oldversion) {
global $CFG, $DB;
Expand Down Expand Up @@ -37,4 +37,4 @@ function xmldb_quiz_overview_upgrade($oldversion) {
return $result;
}

?>

6 changes: 3 additions & 3 deletions mod/quiz/report/overview/overview_table.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php

class quiz_report_overview_table extends table_sql {

Expand Down Expand Up @@ -231,7 +231,7 @@ function other_cols($colname, $attempt){
$link = html_link::make("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id", $grade);
$link->add_action(new popup_action('click', $link->url, 'reviewquestion', array('height' => 450, 'width' => 650)));
$link->title = get_string('reviewresponsetoq', 'quiz', $question->formattedname);
$linktopopup = $OUTPUT->link($link);
$linktopopup = $OUTPUT->link($link);

if (($this->questions[$questionid]->maxgrade != 0)){
$fractionofgrade = $stateforqinattempt->grade
Expand Down Expand Up @@ -331,4 +331,4 @@ function query_db($pagesize, $useinitialsbar=true){
}
}
}
?>

4 changes: 2 additions & 2 deletions mod/quiz/report/overview/overviewgraph.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php
include '../../../../config.php';
include $CFG->dirroot."/lib/graphlib.php";
include $CFG->dirroot."/mod/quiz/report/reportlib.php";
Expand Down Expand Up @@ -96,4 +96,4 @@

$line->parameter['y_axis_gridlines'] = $gridlines+1;
$line->draw();
?>

6 changes: 3 additions & 3 deletions mod/quiz/report/overview/overviewsettings_form.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once "$CFG->libdir/formslib.php";
class mod_quiz_report_overview_settings extends moodleform {

Expand Down Expand Up @@ -42,7 +42,7 @@ function definition() {
}
if ($showattemptsgrp){
$mform->addGroup($showattemptsgrp, null, get_string('showattempts', 'quiz_overview'), '<br />', false);
}
}
//-------------------------------------------------------------------------------
$mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'quiz_overview'));

Expand All @@ -54,4 +54,4 @@ function definition() {
$this->add_action_buttons(false, get_string('preferencessave', 'quiz_overview'));
}
}
?>

67 changes: 33 additions & 34 deletions mod/quiz/report/overview/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/**
* This script lists student attempts
*
* @version $Id$
* @author Martin Dougiamas, Tim Hunt and others.
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package quiz
Expand Down Expand Up @@ -32,7 +31,7 @@ function display($quiz, $cm, $course) {
$showgrades = quiz_has_grades($quiz) && $reviewoptions->scores;

$download = optional_param('download', '', PARAM_ALPHA);

/// find out current groups mode
$currentgroup = groups_get_activity_group($cm, true);
if (!$students = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','','','',false)){
Expand All @@ -54,7 +53,7 @@ function display($quiz, $cm, $course) {
}
$allowed = $groupstudents;
}

if (empty($currentgroup)||$groupstudents) {
if (optional_param('delete', 0, PARAM_BOOL)){
if($attemptids = optional_param('attemptid', array(), PARAM_INT)) {
Expand Down Expand Up @@ -129,7 +128,7 @@ function display($quiz, $cm, $course) {
} else if ($attemptsmode === null){
//default
$attemptsmode = QUIZ_REPORT_ATTEMPTS_ALL;
}
}
if (!$reviewoptions->scores) {
$detailedmarks = 0;
}
Expand Down Expand Up @@ -162,7 +161,7 @@ function display($quiz, $cm, $course) {
// Only print headers if not asked to download data
$this->print_header_and_tabs($cm, $course, $quiz, "overview");
}

if ($regradeall){
$this->regrade_all(false, $quiz, $groupstudents);
} else if ($regradealldry){
Expand All @@ -173,14 +172,14 @@ function display($quiz, $cm, $course) {
if ($regradeall || $regradealldry || $regradealldrydo){
redirect($reporturl->out(false, $displayoptions, false), '', 5);
}

if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
if (!$table->is_downloading()) {
groups_print_activity_menu($cm, $reporturl->out(false, $displayoptions));
}
}


// Print information on the number of existing attempts
if (!$table->is_downloading()) { //do not print notices when downloading
if ($strattemptnum = quiz_num_attempt_summary($quiz, $cm, true, $currentgroup)) {
Expand All @@ -200,14 +199,14 @@ function display($quiz, $cm, $course) {
$mform->set_data($displayoptions +compact('detailedmarks', 'pagesize'));
$mform->display();
}






if (!$nostudents || ($attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL)){



// Construct the SQL
$fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS uniqueid, ';
if ($qmsubselect) {
Expand All @@ -217,7 +216,7 @@ function display($quiz, $cm, $course) {
" ELSE 0 " .
"END) AS gradedattempt, ";
}
$fields .='qa.uniqueid AS attemptuniqueid, qa.id AS attempt, ' .
'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, '.
'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration ';
Expand All @@ -226,7 +225,7 @@ function display($quiz, $cm, $course) {
$from = '{user} u ';
$from .= 'LEFT JOIN {quiz_attempts} qa ON qa.userid = u.id AND qa.quiz = :quizid';
$params = array('quizid' => $quiz->id);

if ($qmsubselect && $qmfilter){
$from .= ' AND '.$qmsubselect;
}
Expand Down Expand Up @@ -254,7 +253,7 @@ function display($quiz, $cm, $course) {
$where = "u.id $allowed_usql AND (qa.preview = 0 OR qa.preview IS NULL)";
break;
}

$table->set_count_sql("SELECT COUNT(1) FROM $from WHERE $where", $params);

$sqlobject = new object;
Expand All @@ -272,7 +271,7 @@ function display($quiz, $cm, $course) {
$where .= ' AND COALESCE((SELECT MAX(qqr.regraded) FROM {quiz_question_regrade} qqr WHERE qqr.attemptid = qa.uniqueid),-1) !=\'-1\'';
}
$table->set_sql($fields, $from, $where, $params);

// Define table columns
$columns = array();
$headers = array();
Expand Down Expand Up @@ -311,12 +310,12 @@ function display($quiz, $cm, $course) {
echo '<div class="quizattemptcounts">' . $strattempthighlight . '</div>';
}
}

if (!$table->is_downloading() && $candelete) {
$columns[]= 'checkbox';
$headers[]= NULL;
}

if (!$table->is_downloading() && $CFG->grade_report_showuserimage) {
$columns[]= 'picture';
$headers[]= '';
Expand All @@ -330,21 +329,21 @@ function display($quiz, $cm, $course) {
$columns[]= 'firstname';
$headers[]= get_string('firstname');
}

if ($CFG->grade_report_showuseridnumber) {
$columns[]= 'idnumber';
$headers[]= get_string('idnumber');
}

$columns[]= 'timestart';
$headers[]= get_string('startedon', 'quiz');

$columns[]= 'timefinish';
$headers[]= get_string('timecompleted','quiz');

$columns[]= 'duration';
$headers[]= get_string('attemptduration', 'quiz');

if ($detailedmarks) {
foreach ($questions as $id => $question) {
// Ignore questions of zero length
Expand All @@ -368,35 +367,35 @@ function display($quiz, $cm, $course) {
$columns[] = 'sumgrades';
$headers[] = get_string('grade', 'quiz').'/'.quiz_format_grade($quiz, $quiz->grade);
}

if ($hasfeedback) {
$columns[] = 'feedbacktext';
$headers[] = get_string('feedback', 'quiz');
}

$table->define_columns($columns);
$table->define_headers($headers);
$table->sortable(true, 'uniqueid');

// Set up the table
$table->define_baseurl($reporturl->out(false, $displayoptions));

$table->collapsible(false);

$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_suppress('idnumber');

$table->no_sorting('feedbacktext');

$table->column_class('picture', 'picture');
$table->column_class('lastname', 'bold');
$table->column_class('firstname', 'bold');
$table->column_class('fullname', 'bold');
$table->column_class('sumgrades', 'bold');

$table->set_attribute('id', 'attempts');

$table->out($pagesize, true);
}
if (!$table->is_downloading() && $showgrades) {
Expand Down Expand Up @@ -648,7 +647,7 @@ function regrade_selected_attempts($quiz, $attemptids, $groupstudents){
list($asql, $aparams) = $DB->get_in_or_equal($attemptids);
$where = "qa.id $asql AND ";
$params = array_merge($params, $aparams);

$where .= "qa.quiz = ? AND qa.preview = 0";
$params[] = $quiz->id;
if (!$attempts = $DB->get_records_sql('SELECT qa.* FROM {quiz_attempts} qa WHERE '. $where, $params)) {
Expand All @@ -671,4 +670,4 @@ function regrade_selected_attempts($quiz, $attemptids, $groupstudents){
}


?>

4 changes: 2 additions & 2 deletions mod/quiz/report/overview/version.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // $Id$
<?php

////////////////////////////////////////////////////////////////////////////////
// Code fragment to define the version of quiz overview report
Expand All @@ -7,4 +7,4 @@

$plugin->version = 2009091400; // The (date) version of this module

?>

Loading

0 comments on commit aeb1553

Please sign in to comment.