@@ -22,9 +22,9 @@ 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($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 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // Therefore, the mass assign only works in cohort without component. |
39 | 39 | // When uniform distribution is enabled, users are uniformly distribute to any group with uniformdistribution = 1 in the relationship, |
40 | 40 | // so uniform distribution needs to be disabled to mass assign users in a specific group. |
41 | -if(!empty($relationshipcohort->component) || $relationshipcohort->uniformdistribution || $relationshipgroup->uniformdistribution) { |
|
41 | +if (!empty($relationshipcohort->component) || $relationshipcohort->uniformdistribution || $relationshipgroup->uniformdistribution) { |
|
42 | 42 | print_error('cantmassassign', 'local_relationship'); |
43 | 43 | } |
44 | 44 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $rcs = relationship_get_cohort_by_roleshortname($relationshipgroup->relationshipid, 'student'); |
127 | 127 | |
128 | 128 | $cohortrole = get_string('none'); |
129 | - if($rcs) { |
|
129 | + if ($rcs) { |
|
130 | 130 | $r = get_string('role'); |
131 | 131 | $cohortrole = "{$rcs->name} ({$r}: $rcs->rolename)"; |
132 | 132 | } |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | $recs = $DB->get_records('relationship_pendencies', array('relationshipgroupid'=>$relationshipgroup->id, 'relationshipcohortid'=>$relationshipcohort->id), 'cpf'); |
139 | 139 | $table = new html_table(); |
140 | - $table->head = array('CPF', get_string('timecreated', 'local_relationship')); |
|
140 | + $table->head = array('CPF', get_string('timecreated', 'local_relationship')); |
|
141 | 141 | $table->data = array(); |
142 | - foreach($recs AS $rec) { |
|
142 | + foreach ($recs AS $rec) { |
|
143 | 143 | $line = array($rec->cpf, userdate($rec->timecreated)); |
144 | 144 | $baseurl->param('id', $rec->id); |
145 | 145 | $baseurl->param('delete', 1); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | defined('MOODLE_INTERNAL') || die(); |
25 | 25 | |
26 | -require_once($CFG->dirroot.'/local/relationship/lib.php'); |
|
26 | +require_once($CFG->dirroot . '/local/relationship/lib.php'); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Event handler for relationship local plugin. |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $idnumber = $DB->get_field('user', 'idnumber', array('id'=>$event->userid)); |
115 | 115 | if (!empty($idnumber)) { |
116 | 116 | $pessoas = \local_ufsc\pessoa::by_key('idpessoa', $idnumber); |
117 | - if(!empty($pessoas)) { |
|
117 | + if (!empty($pessoas)) { |
|
118 | 118 | $pessoa = reset($pessoas); |
119 | 119 | if (!empty($pessoa->cpf)) { |
120 | 120 | $where = 'rp.cpf = :cpf'; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | if (!empty($rec->relationshipcohortid) && !empty($rec->relationshipgroupid)) { |
131 | 131 | $massassign = new \local_relationship\mass_assign_processor($rec->relationshipcohortid, $rec->relationshipgroupid, false, $rec->allowallusers); |
132 | 132 | $result = $massassign->process_relationship($event->userid); |
133 | - if (in_array($result->summary,['assigneduser', 'alreadyingroup'])) { |
|
133 | + if (in_array($result->summary, ['assigneduser', 'alreadyingroup'])) { |
|
134 | 134 | $DB->delete_records('relationship_pendencies', array('id' => $rec->id)); |
135 | 135 | } |
136 | 136 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | defined('MOODLE_INTERNAL') || die(); |
27 | 27 | |
28 | -require_once($CFG->dirroot.'/cohort/lib.php'); |
|
28 | +require_once($CFG->dirroot . '/cohort/lib.php'); |
|
29 | 29 | |
30 | 30 | class mass_assign_processor { |
31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | private $registerpendencies; |
37 | 37 | private $allowallusers; |
38 | 38 | |
39 | - public function __construct($relationshipcohortid, $relationshipgroupid, $registerpendencies=false, $allowallusers=false, $authtype='') { |
|
39 | + public function __construct($relationshipcohortid, $relationshipgroupid, $registerpendencies = false, $allowallusers = false, $authtype = '') { |
|
40 | 40 | global $DB; |
41 | 41 | |
42 | 42 | $this->relationshipcohort = relationship_get_cohort($relationshipcohortid); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | $this->relationshipgroup = $DB->get_record('relationship_groups', array('id' => $relationshipgroupid), '*', MUST_EXIST); |
48 | - if($this->relationshipgroup->uniformdistribution) { |
|
48 | + if ($this->relationshipgroup->uniformdistribution) { |
|
49 | 49 | throw new \moodle_exception('cantmassassign', 'local_relationship'); |
50 | 50 | } |
51 | 51 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | 'desc' => get_string('morethanoneusersccp', 'local_relationship'), |
143 | 143 | 'level' => 'error' |
144 | 144 | ]; |
145 | - } else if(count($pessoas) == 1) { |
|
145 | + } else if (count($pessoas) == 1) { |
|
146 | 146 | $pessoa = reset($pessoas); |
147 | 147 | $moodleuser = $this->find_user('idnumber', $pessoa->idpessoa); |
148 | 148 | if (empty($moodleuser)) { |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | if (empty($result->summary)) { |
333 | - $data = (object)$params; |
|
333 | + $data = (object) $params; |
|
334 | 334 | $data->timecreated = time(); |
335 | 335 | $DB->insert_record('relationship_pendencies', $data); |
336 | 336 | $result->summary = 'registeredaspending'; |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | } else { |
358 | 358 | for ($t = 9; $t < 11; $t++) { |
359 | 359 | for ($d = 0, $c = 0; $c < $t; $c++) { |
360 | - $d += $cpf{$c} * (($t + 1) - $c); |
|
360 | + $d += $cpf{$c}*(($t+1)-$c); |
|
361 | 361 | } |
362 | - $d = ((10 * $d) % 11) % 10; |
|
362 | + $d = ((10*$d)%11)%10; |
|
363 | 363 | if ($cpf{$c} != $d) { |
364 | 364 | return false; |
365 | 365 | } |