These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | // This file is part of Moodle - http://moodle.org/ |
||
3 | // |
||
4 | // Moodle is free software: you can redistribute it and/or modify |
||
5 | // it under the terms of the GNU General Public License as published by |
||
6 | // the Free Software Foundation, either version 3 of the License, or |
||
7 | // (at your option) any later version. |
||
8 | // |
||
9 | // Moodle is distributed in the hope that it will be useful, |
||
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
12 | // GNU General Public License for more details. |
||
13 | // |
||
14 | // You should have received a copy of the GNU General Public License |
||
15 | // along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
||
16 | |||
17 | /** |
||
18 | * Edit Relationship page |
||
19 | * |
||
20 | * @package local_relationship |
||
21 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
||
22 | */ |
||
23 | |||
24 | require_once(__DIR__.'/../../config.php'); |
||
25 | require_once($CFG->libdir.'/filelib.php'); |
||
26 | require($CFG->dirroot.'/local/relationship/lib.php'); |
||
27 | require_once($CFG->dirroot.'/local/relationship/locallib.php'); |
||
28 | |||
29 | require_login(); |
||
30 | |||
31 | $relationshipid = optional_param('relationshipid', 0, PARAM_INT); |
||
32 | if ($relationshipid) { |
||
33 | $relationship = relationship_get_relationship($relationshipid); |
||
34 | $context = context::instance_by_id($relationship->contextid, MUST_EXIST); |
||
0 ignored issues
–
show
|
|||
35 | } else { |
||
36 | $contextid = optional_param('contextid', 0, PARAM_INT); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 17 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
37 | $context = context::instance_by_id($contextid, MUST_EXIST); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 19 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
38 | $relationship = new stdClass(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 14 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
39 | $relationship->id = 0; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
40 | $relationship->contextid = $context->id; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
41 | $relationship->name = ''; |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
42 | $relationship->description = ''; |
||
43 | $relationship->tags = array(); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
44 | } |
||
45 | |||
46 | require_capability('local/relationship:manage', $context); |
||
47 | if (!empty($relationship->component)) { |
||
48 | print_error('cantedit', 'local_relationship'); |
||
49 | } |
||
50 | |||
51 | $baseurl = new moodle_url('/local/relationship/edit.php', array('relationshipid' => $relationship->id, 'contextid' => $context->id)); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
52 | $returnurl = new moodle_url('/local/relationship/index.php', array('contextid' => $context->id)); |
||
53 | |||
54 | if (optional_param('confirmdelete', 0, PARAM_BOOL) && confirm_sesskey() && $relationship->id) { |
||
55 | $res = relationship_delete_relationship($relationship); |
||
56 | if($res == -1) { |
||
57 | print_error('has_cohorts', 'local_relationship'); |
||
58 | } |
||
59 | redirect($returnurl); |
||
60 | } |
||
61 | |||
62 | if (optional_param('delete', 0, PARAM_BOOL) && $relationship->id) { |
||
63 | relationship_set_header($context, $baseurl, $relationship); |
||
64 | relationship_set_title($relationship, 'deleterelationship'); |
||
65 | $yesurl = new moodle_url('/local/relationship/edit.php', array('relationshipid' => $relationship->id, 'confirmdelete' => 1, 'sesskey' => sesskey())); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
66 | $message = get_string('confirmdelete', 'local_relationship', format_string($relationship->name)); |
||
67 | echo $OUTPUT->confirm($message, $yesurl, $returnurl); |
||
68 | echo $OUTPUT->footer(); |
||
69 | die; |
||
70 | } |
||
71 | |||
72 | relationship_set_header($context, $baseurl, $relationship); |
||
73 | |||
74 | $editoroptions = array('maxfiles' => 0, 'context' => $context); |
||
75 | |||
76 | $relationship_editor = file_prepare_standard_editor($relationship, 'description', $editoroptions, $context); |
||
77 | $editform = new \local_relationship\form\edit_relationship(null, array('editoroptions' => $editoroptions, 'data' => $relationship_editor)); |
||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 12 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||
78 | |||
79 | if ($editform->is_cancelled()) { |
||
80 | redirect($returnurl); |
||
81 | } else if ($data = $editform->get_data()) { |
||
82 | $data = file_postupdate_standard_editor($data, 'description', $editoroptions, $context); |
||
83 | if ($data->id) { |
||
84 | relationship_update_relationship($data); |
||
85 | } else { |
||
86 | relationship_add_relationship($data); |
||
87 | } |
||
88 | redirect($returnurl); |
||
89 | } |
||
90 | |||
91 | $action = $relationship_editor->id ? 'editrelationship' : 'addrelationship'; |
||
92 | relationship_set_title($relationship_editor, $action); |
||
93 | echo $editform->display(); |
||
94 | echo $OUTPUT->footer(); |
||
95 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.