@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | namespace local_relationship; |
25 | 25 | defined('MOODLE_INTERNAL') || die(); |
26 | 26 | |
27 | -require_once($CFG->dirroot.'/cohort/lib.php'); |
|
28 | -require($CFG->dirroot.'/local/relationship/lib.php'); |
|
27 | +require_once($CFG->dirroot . '/cohort/lib.php'); |
|
28 | +require($CFG->dirroot . '/local/relationship/lib.php'); |
|
29 | 29 | |
30 | 30 | class mass_assign_processor { |
31 | 31 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->tracker->total++; |
67 | 67 | |
68 | 68 | $moodleuserid = $this->process_user($value); |
69 | - if($moodleuserid) { |
|
69 | + if ($moodleuserid) { |
|
70 | 70 | $this->process_relationship($moodleuserid, $allowallusers); |
71 | 71 | } |
72 | 72 | } |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | } else { |
174 | 174 | for ($t = 9; $t < 11; $t++) { |
175 | 175 | for ($d = 0, $c = 0; $c < $t; $c++) { |
176 | - $d += $cpf{$c} * (($t + 1) - $c); |
|
176 | + $d += $cpf{$c}*(($t+1)-$c); |
|
177 | 177 | } |
178 | - $d = ((10 * $d) % 11) % 10; |
|
178 | + $d = ((10*$d)%11)%10; |
|
179 | 179 | if ($cpf{$c} != $d) { |
180 | 180 | return false; |
181 | 181 | } |
@@ -26,7 +26,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 = core_tag_tag::get_item_tags_array('relationship', 'relationship', $rl->id); |
228 | 228 | } |
229 | 229 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @return mixed |
242 | 242 | * @throws coding_exception |
243 | 243 | */ |
244 | -function relationship_get_cohort_by_roleshortname($relationshipid, $roleshortname, $strictness=IGNORE_MISSING) { |
|
244 | +function relationship_get_cohort_by_roleshortname($relationshipid, $roleshortname, $strictness = IGNORE_MISSING) { |
|
245 | 245 | global $DB; |
246 | 246 | |
247 | 247 | $sql = "SELECT rc.*, ch.name, ch.component, r.name rolename |
@@ -22,8 +22,8 @@ discard block |
||
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_once($CFG->dirroot.'/local/relationship/locallib.php'); |
|
25 | +require_once(__DIR__ . '/../../config.php'); |
|
26 | +require_once($CFG->dirroot . '/local/relationship/locallib.php'); |
|
27 | 27 | |
28 | 28 | require_login(); |
29 | 29 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // Therefore, the mass assign only works in cohort without component. |
38 | 38 | // When uniform distribution is enabled, users are uniformly distribute to any group with uniformdistribution = 1 in the relationship, |
39 | 39 | // so uniform distribution needs to be disabled to mass assign users in a specific group. |
40 | -if(!empty($relationshipcohort->component) || $relationshipcohort->uniformdistribution || $relationshipgroup->uniformdistribution) { |
|
40 | +if (!empty($relationshipcohort->component) || $relationshipcohort->uniformdistribution || $relationshipgroup->uniformdistribution) { |
|
41 | 41 | print_error('cantmassassign', 'local_relationship'); |
42 | 42 | } |
43 | 43 |