Skip to content

Commit

Permalink
Appeasing the CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
mchurchward committed Mar 7, 2023
1 parent 857f482 commit 4eb3d5a
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 143 deletions.
6 changes: 3 additions & 3 deletions backup/moodle1/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public function get_paths() {
public function process_questionnaire($data) {
// Get the course module id and context id.
$instanceid = $data['id'];
$cminfo = $this->get_cminfo($instanceid);
$moduleid = $cminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);
$cminfo = $this->get_cminfo($instanceid);
$moduleid = $cminfo['id'];
$contextid = $this->converter->get_contextid(CONTEXT_MODULE, $moduleid);

// We now have all information needed to start writing into the file.
$this->open_xml_writer("activities/questionnaire_{$moduleid}/questionnaire.xml");
Expand Down
34 changes: 17 additions & 17 deletions classes/question/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ abstract class question {

// Class Properties.
/** @var int $id The database id of this question. */
public $id = 0;
public $id = 0;

/** @var int $surveyid The database id of the survey this question belongs to. */
public $surveyid = 0;
public $surveyid = 0;

/** @var string $name The name of this question. */
public $name = '';
public $name = '';

/** @var string $type The name of the question type. */
public $type = '';
public $type = '';

/** @var array $choices Array holding any choices for this question. */
public $choices = [];
public $choices = [];

/** @var array $dependencies Array holding any dependencies for this question. */
public $dependencies = [];
Expand All @@ -83,25 +83,25 @@ abstract class question {
public $responsetable = '';

/** @var int $length The length field. */
public $length = 0;
public $length = 0;

/** @var int $precise The precision field. */
public $precise = 0;
public $precise = 0;

/** @var int $position Position in the questionnaire */
public $position = 0;
public $position = 0;

/** @var string $content The question's content. */
public $content = '';
public $content = '';

/** @var string $allchoices The list of all question's choices. */
public $allchoices = '';
public $allchoices = '';

/** @var boolean $required The required flag. */
public $required = 'n';
public $required = 'n';

/** @var boolean $deleted The deleted flag. */
public $deleted = 'n';
public $deleted = 'n';

/** @var mixed $extradata Any custom data for the question type. */
public $extradata = '';
Expand Down Expand Up @@ -1303,8 +1303,8 @@ public function form_update($formdata, $questionnaire) {

// Update existing question.
// Handle any attachments in the content.
$formdata->itemid = $formdata->content['itemid'];
$formdata->format = $formdata->content['format'];
$formdata->itemid = $formdata->content['itemid'];
$formdata->format = $formdata->content['format'];
$formdata->content = $formdata->content['text'];
$formdata->content = file_save_draft_area_files($formdata->itemid, $questionnaire->context->id, 'mod_questionnaire',
'question', $formdata->qid, ['subdirs' => true], $formdata->content);
Expand Down Expand Up @@ -1339,10 +1339,10 @@ public function form_update($formdata, $questionnaire) {
$this->add($questionrecord);

// Handle any attachments in the content.
$formdata->itemid = $formdata->content['itemid'];
$formdata->format = $formdata->content['format'];
$formdata->itemid = $formdata->content['itemid'];
$formdata->format = $formdata->content['format'];
$formdata->content = $formdata->content['text'];
$content = file_save_draft_area_files($formdata->itemid, $questionnaire->context->id, 'mod_questionnaire',
$content = file_save_draft_area_files($formdata->itemid, $questionnaire->context->id, 'mod_questionnaire',
'question', $this->qid, ['subdirs' => true], $formdata->content);
$DB->set_field('questionnaire_question', 'content', $content, ['id' => $this->qid]);
}
Expand Down
2 changes: 1 addition & 1 deletion complete.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
$questionnaire->add_page(new \mod_questionnaire\output\completepage());

$questionnaire->strquestionnaires = get_string("modulenameplural", "questionnaire");
$questionnaire->strquestionnaire = get_string("modulename", "questionnaire");
$questionnaire->strquestionnaire = get_string("modulename", "questionnaire");

// Mark as viewed.
$completion = new completion_info($course);
Expand Down
32 changes: 16 additions & 16 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,12 @@ function questionnaire_grade_item_update($questionnaire, $grades = null) {

if ($questionnaire->grade > 0) {
$params['gradetype'] = GRADE_TYPE_VALUE;
$params['grademax'] = $questionnaire->grade;
$params['grademin'] = 0;
$params['grademax'] = $questionnaire->grade;
$params['grademin'] = 0;

} else if ($questionnaire->grade < 0) {
$params['gradetype'] = GRADE_TYPE_SCALE;
$params['scaleid'] = -$questionnaire->grade;
$params['scaleid'] = -$questionnaire->grade;

} else if ($questionnaire->grade == 0) { // No Grade..be sure to delete the grade item if it exists.
$grades = null;
Expand Down Expand Up @@ -865,11 +865,11 @@ function questionnaire_get_recent_mod_activity(&$activities, &$index, $timestart

if ($groupid) {
$groupselect = 'AND gm.groupid = :groupid';
$groupjoin = 'JOIN {groups_members} gm ON gm.userid=u.id';
$groupjoin = 'JOIN {groups_members} gm ON gm.userid=u.id';
$params['groupid'] = $groupid;
} else {
$groupselect = '';
$groupjoin = '';
$groupjoin = '';
}

$params['timestart'] = $timestart;
Expand All @@ -891,8 +891,8 @@ function questionnaire_get_recent_mod_activity(&$activities, &$index, $timestart
}

$accessallgroups = has_capability('moodle/site:accessallgroups', $context);
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
$groupmode = groups_get_activity_groupmode($cm, $course);
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
$groupmode = groups_get_activity_groupmode($cm, $course);

$usersgroups = null;
$aname = format_string($cm->name, true);
Expand Down Expand Up @@ -929,19 +929,19 @@ function questionnaire_get_recent_mod_activity(&$activities, &$index, $timestart

$tmpactivity = new stdClass();

$tmpactivity->type = 'questionnaire';
$tmpactivity->cmid = $cm->id;
$tmpactivity->type = 'questionnaire';
$tmpactivity->cmid = $cm->id;
$tmpactivity->cminstance = $cm->instance;
// Current user is admin - or teacher enrolled in original public course.
if (isset($cmoriginal)) {
$tmpactivity->cminstance = $cmoriginal->instance;
}
$tmpactivity->cannotview = false;
$tmpactivity->anonymous = false;
$tmpactivity->name = $aname;
$tmpactivity->anonymous = false;
$tmpactivity->name = $aname;
$tmpactivity->sectionnum = $cm->sectionnum;
$tmpactivity->timestamp = $attempt->submitted;
$tmpactivity->groupid = $groupid;
$tmpactivity->timestamp = $attempt->submitted;
$tmpactivity->groupid = $groupid;
if (isset($userattempts[$attempt->lastname])) {
$tmpactivity->nbattempts = $userattempts[$attempt->lastname];
}
Expand All @@ -963,7 +963,7 @@ function questionnaire_get_recent_mod_activity(&$activities, &$index, $timestart
}
}
if ($questionnaire->respondenttype != 'anonymous') {
$tmpactivity->user->fullname = fullname($attempt, $viewfullnames);
$tmpactivity->user->fullname = fullname($attempt, $viewfullnames);
} else {
$tmpactivity->user = '';
unset ($tmpactivity->user);
Expand Down Expand Up @@ -1065,9 +1065,9 @@ function questionnaire_print_overview($courses, &$htmlarray) {
}

// Get Necessary Strings.
$strquestionnaire = get_string('modulename', 'questionnaire');
$strquestionnaire = get_string('modulename', 'questionnaire');
$strnotattempted = get_string('noattempts', 'questionnaire');
$strattempted = get_string('attempted', 'questionnaire');
$strattempted = get_string('attempted', 'questionnaire');
$strsavedbutnotsubmitted = get_string('savedbutnotsubmitted', 'questionnaire');

$now = time();
Expand Down
30 changes: 15 additions & 15 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,23 @@ function questionnaire_load_capabilities($cmid) {
$context = questionnaire_get_context($cmid);

$cb = new stdClass();
$cb->view = has_capability('mod/questionnaire:view', $context);
$cb->submit = has_capability('mod/questionnaire:submit', $context);
$cb->viewsingleresponse = has_capability('mod/questionnaire:viewsingleresponse', $context);
$cb->view = has_capability('mod/questionnaire:view', $context);
$cb->submit = has_capability('mod/questionnaire:submit', $context);
$cb->viewsingleresponse = has_capability('mod/questionnaire:viewsingleresponse', $context);
$cb->submissionnotification = has_capability('mod/questionnaire:submissionnotification', $context);
$cb->downloadresponses = has_capability('mod/questionnaire:downloadresponses', $context);
$cb->deleteresponses = has_capability('mod/questionnaire:deleteresponses', $context);
$cb->manage = has_capability('mod/questionnaire:manage', $context);
$cb->editquestions = has_capability('mod/questionnaire:editquestions', $context);
$cb->createtemplates = has_capability('mod/questionnaire:createtemplates', $context);
$cb->createpublic = has_capability('mod/questionnaire:createpublic', $context);
$cb->readownresponses = has_capability('mod/questionnaire:readownresponses', $context);
$cb->readallresponses = has_capability('mod/questionnaire:readallresponses', $context);
$cb->downloadresponses = has_capability('mod/questionnaire:downloadresponses', $context);
$cb->deleteresponses = has_capability('mod/questionnaire:deleteresponses', $context);
$cb->manage = has_capability('mod/questionnaire:manage', $context);
$cb->editquestions = has_capability('mod/questionnaire:editquestions', $context);
$cb->createtemplates = has_capability('mod/questionnaire:createtemplates', $context);
$cb->createpublic = has_capability('mod/questionnaire:createpublic', $context);
$cb->readownresponses = has_capability('mod/questionnaire:readownresponses', $context);
$cb->readallresponses = has_capability('mod/questionnaire:readallresponses', $context);
$cb->readallresponseanytime = has_capability('mod/questionnaire:readallresponseanytime', $context);
$cb->printblank = has_capability('mod/questionnaire:printblank', $context);
$cb->preview = has_capability('mod/questionnaire:preview', $context);
$cb->printblank = has_capability('mod/questionnaire:printblank', $context);
$cb->preview = has_capability('mod/questionnaire:preview', $context);

$cb->viewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $context, null, false);
$cb->viewhiddenactivities = has_capability('moodle/course:viewhiddenactivities', $context, null, false);

return $cb;
}
Expand Down Expand Up @@ -534,7 +534,7 @@ function questionnaire_set_events($questionnaire) {
calendar_event::create($event);
} else {
// Separate start and end events.
$event->timeduration = 0;
$event->timeduration = 0;
if ($questionnaire->opendate) {
$event->name = $questionnaire->name.' ('.get_string('questionnaireopens', 'questionnaire').')';
$event->timesort = $questionnaire->opendate;
Expand Down
8 changes: 4 additions & 4 deletions preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
require_once("../../config.php");
require_once($CFG->dirroot.'/mod/questionnaire/questionnaire.class.php');

$id = optional_param('id', 0, PARAM_INT);
$sid = optional_param('sid', 0, PARAM_INT);
$popup = optional_param('popup', 0, PARAM_INT);
$qid = optional_param('qid', 0, PARAM_INT);
$id = optional_param('id', 0, PARAM_INT);
$sid = optional_param('sid', 0, PARAM_INT);
$popup = optional_param('popup', 0, PARAM_INT);
$qid = optional_param('qid', 0, PARAM_INT);
$currentgroupid = optional_param('group', 0, PARAM_INT); // Groupid.

if ($id) {
Expand Down
12 changes: 6 additions & 6 deletions qsettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@

$sdata->infoitemid = $settings->info['itemid'];
$sdata->infoformat = $settings->info['format'];
$sdata->info = $settings->info['text'];
$sdata->info = file_save_draft_area_files($sdata->infoitemid, $context->id, 'mod_questionnaire', 'info',
$sdata->id, array('subdirs' => true), $sdata->info);
$sdata->info = $settings->info['text'];
$sdata->info = file_save_draft_area_files($sdata->infoitemid, $context->id, 'mod_questionnaire', 'info',
$sdata->id, array('subdirs' => true), $sdata->info);

$sdata->theme = ''; // Deprecated theme field.
$sdata->thanks_page = $settings->thanks_page;
$sdata->thank_head = $settings->thank_head;

$sdata->thankitemid = $settings->thank_body['itemid'];
$sdata->thankformat = $settings->thank_body['format'];
$sdata->thank_body = $settings->thank_body['text'];
$sdata->thank_body = file_save_draft_area_files($sdata->thankitemid, $context->id, 'mod_questionnaire', 'thankbody',
$sdata->id, array('subdirs' => true), $sdata->thank_body);
$sdata->thank_body = $settings->thank_body['text'];
$sdata->thank_body = file_save_draft_area_files($sdata->thankitemid, $context->id, 'mod_questionnaire', 'thankbody',
$sdata->id, array('subdirs' => true), $sdata->thank_body);
$sdata->email = $settings->email;

$sdata->courseid = $settings->courseid;
Expand Down
34 changes: 17 additions & 17 deletions questionnaire.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2125,21 +2125,21 @@ private function send_submission_notifications($rid) {
*/
private function send_message($info, $eventtype) {
$eventdata = new \core\message\message();
$eventdata->courseid = $this->course->id;
$eventdata->modulename = 'questionnaire';
$eventdata->userfrom = $info->userfrom;
$eventdata->userto = $info->userto;
$eventdata->subject = $info->postsubject;
$eventdata->fullmessage = $info->posttext;
$eventdata->courseid = $this->course->id;
$eventdata->modulename = 'questionnaire';
$eventdata->userfrom = $info->userfrom;
$eventdata->userto = $info->userto;
$eventdata->subject = $info->postsubject;
$eventdata->fullmessage = $info->posttext;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = $info->posthtml;
$eventdata->smallmessage = $info->postsubject;
$eventdata->fullmessagehtml = $info->posthtml;
$eventdata->smallmessage = $info->postsubject;

$eventdata->name = $eventtype;
$eventdata->component = 'mod_questionnaire';
$eventdata->notification = 1;
$eventdata->contexturl = $info->submissionurl;
$eventdata->contexturlname = $info->name;
$eventdata->name = $eventtype;
$eventdata->component = 'mod_questionnaire';
$eventdata->notification = 1;
$eventdata->contexturl = $info->submissionurl;
$eventdata->contexturlname = $info->name;

message_send($eventdata);
}
Expand Down Expand Up @@ -2362,10 +2362,10 @@ private function response_send_email($rid, $email) {
'&amp;rid='.$rid.'&amp;instance='.$this->id;

// Html and plaintext body.
$bodyhtml = '<a href="'.$url.'">'.$url.'</a>'.$endhtml;
$bodyplaintext = $url.$endplaintext;
$bodyhtml .= get_string('surveyresponse', 'questionnaire') .' "'.$name.'"'.$endhtml;
$bodyplaintext .= get_string('surveyresponse', 'questionnaire') .' "'.$name.'"'.$endplaintext;
$bodyhtml = '<a href="'.$url.'">'.$url.'</a>'.$endhtml;
$bodyplaintext = $url.$endplaintext;
$bodyhtml .= get_string('surveyresponse', 'questionnaire') .' "'.$name.'"'.$endhtml;
$bodyplaintext .= get_string('surveyresponse', 'questionnaire') .' "'.$name.'"'.$endplaintext;

$bodyhtml .= $answers['html'];
$bodyplaintext .= $answers['plaintext'];
Expand Down
14 changes: 7 additions & 7 deletions questions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
require_once($CFG->dirroot.'/mod/questionnaire/questionnaire.class.php');
require_once($CFG->dirroot.'/mod/questionnaire/classes/question/question.php'); // Needed for question type constants.

$id = required_param('id', PARAM_INT); // Course module ID.
$id = required_param('id', PARAM_INT); // Course module ID.
$action = optional_param('action', 'main', PARAM_ALPHA); // Screen.
$qid = optional_param('qid', 0, PARAM_INT); // Question id.
$moveq = optional_param('moveq', 0, PARAM_INT); // Question id to move.
$delq = optional_param('delq', 0, PARAM_INT); // Question id to delete.
$qtype = optional_param('type_id', 0, PARAM_INT); // Question type.
$qid = optional_param('qid', 0, PARAM_INT); // Question id.
$moveq = optional_param('moveq', 0, PARAM_INT); // Question id to move.
$delq = optional_param('delq', 0, PARAM_INT); // Question id to delete.
$qtype = optional_param('type_id', 0, PARAM_INT); // Question type.
$currentgroupid = optional_param('group', 0, PARAM_INT); // Group id.

if (! $cm = get_coursemodule_from_id('questionnaire', $id)) {
Expand Down Expand Up @@ -401,8 +401,8 @@
$qid = key($qformdata->removebutton);
if ($dependants) {
// Show the dependencies and inform about the dependencies to be removed.
// Split dependencies in direct and indirect ones to separate for the confirm-dialogue. Only direct ones will be deleted.
// List direct dependencies.
// Split dependencies in direct and indirect ones to separate for the confirm-dialogue.
// Only direct ones will be deleted. List direct dependencies.
$msg .= $questionnaire->renderer->dependency_warnings($dependants->directs, 'directwarnings', $strnum);
// List indirect dependencies.
$msg .= $questionnaire->renderer->dependency_warnings($dependants->indirects, 'indirectwarnings', $strnum);
Expand Down
4 changes: 2 additions & 2 deletions report.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@
$name = preg_replace("/[^A-Z0-9]+/i", "_", trim($name));

$choicecodes = optional_param('choicecodes', '0', PARAM_INT);
$choicetext = optional_param('choicetext', '0', PARAM_INT);
$showincompletes = optional_param('complete', '0', PARAM_INT);
$choicetext = optional_param('choicetext', '0', PARAM_INT);
$showincompletes = optional_param('complete', '0', PARAM_INT);
$rankaverages = optional_param('rankaverages', '0', PARAM_INT);
$dataformat = optional_param('downloadformat', '', PARAM_ALPHA);
$emailroles = optional_param('emailroles', 0, PARAM_INT);
Expand Down
Loading

0 comments on commit 4eb3d5a

Please sign in to comment.