Passed
Push — master ( e92374...1c08c9 )
by Roberto
03:19
created
classes/candidate_selector.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
         list($usercondition, $params) = users_search_sql($search, 'u', $this->searchanywhere);
40 40
 
41
-        if(!empty($this->validatinguserids)) {
41
+        if (!empty($this->validatinguserids)) {
42 42
             list($usertest, $userparams) = $DB->get_in_or_equal($this->validatinguserids, SQL_PARAMS_NAMED, 'val');
43 43
             $usercondition .= " AND u.id*1000000+rc.id " . $usertest;
44 44
             $params = array_merge($params, $userparams);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                        OR (rc.allowdupsingroups = 0 AND rm.id IS NULL))
67 67
                   AND {$usercondition}";
68 68
 
69
-        $orderby= "ORDER BY roleid, in_group, fullname";
69
+        $orderby = "ORDER BY roleid, in_group, fullname";
70 70
 
71 71
         if (!$this->is_validating()) {
72 72
             $sql = $countfields . "\n" . $from;
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
             }
79 79
         }
80 80
 
81
-        $sql = $selectfields . "\n" . $from .  "\n" . $orderby;
81
+        $sql = $selectfields . "\n" . $from . "\n" . $orderby;
82 82
 
83 83
         $users = array();
84 84
         $roleid = -1;
85 85
         $in_group = -1;
86 86
         $index = false;
87
-        foreach($DB->get_recordset_sql($sql, $params) AS $cand) {
88
-            if($cand->roleid != $roleid || $cand->in_group != $in_group) {
87
+        foreach ($DB->get_recordset_sql($sql, $params) AS $cand) {
88
+            if ($cand->roleid != $roleid || $cand->in_group != $in_group) {
89 89
                 $role = $DB->get_record('role', array('id'=>$cand->roleid), '*', MUST_EXIST);
90 90
                 $role_name = role_get_name($role);
91 91
 
92
-                $str_alloc = $cand->in_group == 1  ? get_string('allocated', 'local_relationship') : get_string('notallocated', 'local_relationship');
92
+                $str_alloc = $cand->in_group == 1 ? get_string('allocated', 'local_relationship') : get_string('notallocated', 'local_relationship');
93 93
                 $index = $role_name . $str_alloc;
94 94
                 $users[$index] = array();
95 95
 
Please login to merge, or discard this patch.
assign.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22 22
  */
23 23
 
24
-require_once(__DIR__.'/../../config.php');
25
-require($CFG->dirroot.'/local/relationship/lib.php');
26
-require_once($CFG->dirroot.'/local/relationship/locallib.php');
24
+require_once(__DIR__ . '/../../config.php');
25
+require($CFG->dirroot . '/local/relationship/lib.php');
26
+require_once($CFG->dirroot . '/local/relationship/locallib.php');
27 27
 
28 28
 require_login();
29 29
 
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
                     <td id="buttonscell">
99 99
                         <div id="addcontrols">
100 100
                             <input name="add" id="add" type="submit"
101
-                                   value="<?php echo $OUTPUT->larrow().'&nbsp;'.s(get_string('add')); ?>"
101
+                                   value="<?php echo $OUTPUT->larrow() . '&nbsp;' . s(get_string('add')); ?>"
102 102
                                    title="<?php p(get_string('add')); ?>"/><br/>
103 103
                         </div>
104 104
 
105 105
                         <div id="removecontrols">
106 106
                             <input name="remove" id="remove" type="submit"
107
-                                   value="<?php echo s(get_string('remove')).'&nbsp;'.$OUTPUT->rarrow(); ?>"
107
+                                   value="<?php echo s(get_string('remove')) . '&nbsp;' . $OUTPUT->rarrow(); ?>"
108 108
                                    title="<?php p(get_string('remove')); ?>"/>
109 109
                         </div>
110 110
                     </td>
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 23
  */
24 24
 
25
-require_once(__DIR__.'/../../config.php');
26
-require($CFG->dirroot.'/local/relationship/lib.php');
27
-require_once($CFG->dirroot.'/local/relationship/locallib.php');
25
+require_once(__DIR__ . '/../../config.php');
26
+require($CFG->dirroot . '/local/relationship/lib.php');
27
+require_once($CFG->dirroot . '/local/relationship/locallib.php');
28 28
 
29 29
 require_login();
30 30
 $contextid = required_param('contextid', PARAM_INT);
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 $count = '';
62 62
 if ($relationships['allrelationships'] > 0) {
63 63
     if ($searchquery === '') {
64
-        $count = ' ('.$relationships['allrelationships'].')';
64
+        $count = ' (' . $relationships['allrelationships'] . ')';
65 65
     } else {
66
-        $count = ' ('.$relationships['totalrelationships'].'/'.$relationships['allrelationships'].')';
66
+        $count = ' (' . $relationships['totalrelationships'] . '/' . $relationships['allrelationships'] . ')';
67 67
     }
68 68
 }
69 69
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     if ($course_count > 0) {
98 98
         $url = new moodle_url('/local/relationship/index.php', array('contextid' => $contextid, 'relationshipid' => $relationship->id));
99 99
         $link = html_writer::link($url, get_string('list', 'local_relationship'));
100
-        $line[] = $course_count.' ('.$link.')';
100
+        $line[] = $course_count . ' (' . $link . ')';
101 101
     } else {
102 102
         $line[] = $course_count;
103 103
     }
Please login to merge, or discard this patch.
autogroup.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22 22
  */
23 23
 
24
-require_once(__DIR__.'/../../config.php');
25
-require($CFG->dirroot.'/local/relationship/lib.php');
26
-require_once($CFG->dirroot.'/local/relationship/locallib.php');
27
-require_once($CFG->dirroot.'/group/lib.php');
24
+require_once(__DIR__ . '/../../config.php');
25
+require($CFG->dirroot . '/local/relationship/lib.php');
26
+require_once($CFG->dirroot . '/local/relationship/locallib.php');
27
+require_once($CFG->dirroot . '/group/lib.php');
28 28
 
29 29
 require_login();
30 30
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
         $table->data = array();
105 105
         foreach ($new_groups as $group) {
106 106
             if ($group['exists']) {
107
-                $text = html_writer::tag('span', $group['name'], array('style' => 'color:red; font-weight: bold;')).get_string('alreadyexists', 'local_relationship');
107
+                $text = html_writer::tag('span', $group['name'], array('style' => 'color:red; font-weight: bold;')) . get_string('alreadyexists', 'local_relationship');
108 108
             } else if ($group['exists_external']) {
109
-                $text = html_writer::tag('span', $group['name'], array('style' => 'color:red; font-weight: bold;')).get_string('alreadyexistsexternal', 'local_relationship');
109
+                $text = html_writer::tag('span', $group['name'], array('style' => 'color:red; font-weight: bold;')) . get_string('alreadyexistsexternal', 'local_relationship');
110 110
             } else {
111 111
                 $text = $group['name'];
112 112
             }
Please login to merge, or discard this patch.
edit_cohort.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21 21
  */
22 22
 
23
-require_once(__DIR__.'/../../config.php');
24
-require($CFG->dirroot.'/local/relationship/lib.php');
25
-require_once($CFG->dirroot.'/local/relationship/locallib.php');
23
+require_once(__DIR__ . '/../../config.php');
24
+require($CFG->dirroot . '/local/relationship/lib.php');
25
+require_once($CFG->dirroot . '/local/relationship/locallib.php');
26 26
 
27 27
 require_login();
28 28
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 relationship_set_header($context, $baseurl, $relationship, 'cohorts');
59 59
 
60 60
 if (optional_param('delete', 0, PARAM_BOOL) && $relationshipcohort->id) {
61
-    $desc = format_string($relationshipcohort->role_name.'/'.$relationshipcohort->cohort->name);
61
+    $desc = format_string($relationshipcohort->role_name . '/' . $relationshipcohort->cohort->name);
62 62
     relationship_set_title($relationship, 'deletecohort', $desc);
63 63
     echo $OUTPUT->notification(get_string('deletecohortwarning', 'local_relationship'));
64 64
     $yesurl = new moodle_url('/local/relationship/edit_cohort.php', array('relationshipcohortid' => $relationshipcohort->id, 'relationshipid' => $relationship->id, 'delete' => 1, 'confirmedelete' => 1, 'sesskey' => sesskey()));
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 }
83 83
 
84 84
 if ($relationshipcohort->id) {
85
-    $desc = format_string($relationshipcohort->role_name.'/'.$relationshipcohort->cohort->name);
85
+    $desc = format_string($relationshipcohort->role_name . '/' . $relationshipcohort->cohort->name);
86 86
     relationship_set_title($relationship, 'editcohort', $desc);
87 87
 } else {
88 88
     relationship_set_title($relationship, 'addcohort');
Please login to merge, or discard this patch.
groups.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22 22
  */
23 23
 
24
-require_once(__DIR__.'/../../config.php');
25
-require($CFG->dirroot.'/local/relationship/lib.php');
26
-require_once($CFG->dirroot.'/local/relationship/locallib.php');
27
-require_once($CFG->libdir.'/adminlib.php');
24
+require_once(__DIR__ . '/../../config.php');
25
+require($CFG->dirroot . '/local/relationship/lib.php');
26
+require_once($CFG->dirroot . '/local/relationship/locallib.php');
27
+require_once($CFG->libdir . '/adminlib.php');
28 28
 
29 29
 require_login();
30 30
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     }
65 65
     if ($editable) {
66 66
         $url = new moodle_url('/local/relationship/edit_group.php', array('relationshipgroupid' => $relationshipgroup->id, 'uniformdistribution' => $uniformdistribution));
67
-        $line[] = $status.' ('.html_writer::link($url, $text).')';
67
+        $line[] = $status . ' (' . html_writer::link($url, $text) . ')';
68 68
     } else {
69 69
         $line[] = $status;
70 70
     }
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 $table = new html_table();
88 88
 $table->head = array(get_string('name', 'local_relationship'),
89 89
         get_string('memberscount', 'local_relationship'),
90
-        get_string('limit', 'local_relationship').$OUTPUT->help_icon('userlimit', 'local_relationship'),
91
-        get_string('uniformdistribute', 'local_relationship').$OUTPUT->help_icon('uniformdistribute', 'local_relationship'),
90
+        get_string('limit', 'local_relationship') . $OUTPUT->help_icon('userlimit', 'local_relationship'),
91
+        get_string('uniformdistribute', 'local_relationship') . $OUTPUT->help_icon('uniformdistribute', 'local_relationship'),
92 92
         get_string('edit'));
93 93
 $table->colclasses = array('leftalign name',
94 94
         'leftalign size',
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
     $addgroup = new single_button(new moodle_url('/local/relationship/edit_group.php', array('relationshipid' => $relationshipid)), get_string('addgroup', 'local_relationship'));
137 137
     $addgroups = new single_button(new moodle_url('/local/relationship/autogroup.php', array('relationshipid' => $relationshipid)), get_string('autogroup', 'local_relationship'));
138
-    echo html_writer::tag('div', $OUTPUT->render($addgroup).$OUTPUT->render($addgroups), array('class' => 'buttons'));
138
+    echo html_writer::tag('div', $OUTPUT->render($addgroup) . $OUTPUT->render($addgroups), array('class' => 'buttons'));
139 139
 } else if ($manager) {
140 140
     echo $OUTPUT->heading(get_string('noeditable', 'local_relationship'));
141 141
 }
Please login to merge, or discard this patch.
locallib.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 require_once($CFG->dirroot . '/user/selector/lib.php');
27 27
 require_once($CFG->dirroot . '/tag/lib.php');
28 28
 
29
-function relationship_set_header($context, $url, $relationship=null, $module=null) {
29
+function relationship_set_header($context, $url, $relationship = null, $module = null) {
30 30
     global $PAGE, $COURSE, $DB;
31 31
 
32 32
     if ($context->contextlevel != CONTEXT_COURSECAT) {
@@ -43,27 +43,27 @@  discard block
 block discarded – undo
43 43
 
44 44
     $PAGE->navbar->add($category->name, new moodle_url('/course/index.php', array('categoryid'=>$category->id)));
45 45
     $PAGE->navbar->add($navtitle, new moodle_url('/local/relationship/index.php', array('contextid'=>$context->id)));
46
-    if($module) {
46
+    if ($module) {
47 47
         $PAGE->navbar->add(get_string($module, 'local_relationship'),
48 48
                            new moodle_url("/local/relationship/{$module}.php", array('relationshipid'=>$relationship->id)));
49 49
     }
50 50
 }
51 51
 
52
-function relationship_set_title($relationship=null, $action=null, $param=null) {
52
+function relationship_set_title($relationship = null, $action = null, $param = null) {
53 53
     global $OUTPUT;
54 54
 
55 55
     echo $OUTPUT->header();
56
-    if($relationship) {
56
+    if ($relationship) {
57 57
         echo $OUTPUT->heading(get_string('relationship', 'local_relationship') . ': ' . format_string($relationship->name));
58 58
         echo html_writer::empty_tag('BR');
59 59
     }
60
-    if($action) {
60
+    if ($action) {
61 61
         echo $OUTPUT->heading(get_string($action, 'local_relationship', $param), '4');
62 62
     }
63 63
 }
64 64
 
65
-function relationship_groups_parse_name($format, $value, $value_is_a_name=false) {
66
-    if($value_is_a_name) {
65
+function relationship_groups_parse_name($format, $value, $value_is_a_name = false) {
66
+    if ($value_is_a_name) {
67 67
         if (strstr($format, '@') !== false) {
68 68
             $str = str_replace('@', $value, $format);
69 69
         } else {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     } else {
73 73
         if (strstr($format, '@') !== false) { // Convert $value to a character series
74 74
             $letter = 'A';
75
-            for($i=0; $i<$value; $i++) {
75
+            for ($i = 0; $i < $value; $i++) {
76 76
                 $letter++;
77 77
             }
78 78
             $str = str_replace('@', $letter, $format);
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
     $all_roles = role_get_names();
88 88
     $ctx_roles = get_roles_for_contextlevels(CONTEXT_COURSE);
89 89
     $roles = array();
90
-    foreach($ctx_roles AS $id=>$roleid) {
91
-        if($roleid > 2) {
90
+    foreach ($ctx_roles AS $id=>$roleid) {
91
+        if ($roleid > 2) {
92 92
             $roles[$roleid] = $all_roles[$roleid]->localname;
93 93
         }
94 94
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     $context = context::instance_by_id($relationship->contextid);
104 104
 
105 105
     $contextids = array();
106
-    foreach($context->get_parent_context_ids(true) as $ctxid) {
106
+    foreach ($context->get_parent_context_ids(true) as $ctxid) {
107 107
         $context = context::instance_by_id($ctxid);
108 108
         if (has_capability('moodle/cohort:view', $context)) {
109 109
             $contextids[] = $ctxid;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                AND g.idnumber NOT LIKE 'relationship_{$relationshipid}_%'
140 140
           ORDER BY g.name";
141 141
     $groups = array();
142
-    foreach($DB->get_records_sql($sql, array('relationshipid'=>$relationshipid)) as $r) {
142
+    foreach ($DB->get_records_sql($sql, array('relationshipid'=>$relationshipid)) as $r) {
143 143
         $groups[$r->name][] = $r;
144 144
     }
145 145
     return $groups;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     $allrelationships = $DB->count_records('relationship', array('contextid'=>$contextid));
224 224
     $totalrelationships = $DB->count_records_sql($countfields . $sql, $params);
225 225
     $relationships = $DB->get_records_sql($fields . $sql . $order, $params, $page*$perpage, $perpage);
226
-    foreach($relationships as $rl) {
226
+    foreach ($relationships as $rl) {
227 227
         $rl->tags = tag_get_tags_array('relationship', $rl->id);
228 228
     }
229 229
 
Please login to merge, or discard this patch.