-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from stronk7/phpcs_phpdoc_fixes
Phpcs phpdoc fixes
- Loading branch information
Showing
24 changed files
with
273 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// This file is part of Moodle - https://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
|
@@ -12,7 +12,7 @@ | |
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* AJAX search for the user on jabber aliases search.. | ||
|
@@ -21,7 +21,7 @@ | |
* | ||
* @package local_chatlogs | ||
* @copyright 2012 David Mudrak <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
define('AJAX_SCRIPT', true); | ||
|
@@ -44,7 +44,7 @@ | |
$response = new stdClass(); | ||
$response->status = 'ok'; | ||
$response->query = $query; | ||
$response->results = array(); | ||
$response->results = []; | ||
|
||
if (!empty($query)) { | ||
|
||
|
@@ -63,33 +63,33 @@ | |
FROM {user} | ||
WHERE ".$DB->sql_like("firstname", "?", false, false)." | ||
AND ".$DB->sql_like("lastname", "?", false, false); | ||
$params = array( | ||
$params = [ | ||
$DB->sql_like_escape($parts[0]).'%', | ||
$DB->sql_like_escape($parts[1]).'%' | ||
); | ||
$DB->sql_like_escape($parts[1]).'%', | ||
]; | ||
} else { | ||
$sql = "SELECT id, firstname, lastname, email | ||
FROM {user} | ||
WHERE ".$DB->sql_like("firstname", "?", false, false)." | ||
OR ".$DB->sql_like("lastname", "?", false, false)." | ||
OR ".$DB->sql_like("email", "?", false, false); | ||
$params = array( | ||
$params = [ | ||
'%'.$DB->sql_like_escape($query).'%', | ||
'%'.$DB->sql_like_escape($query).'%', | ||
'%'.$DB->sql_like_escape($query).'%' | ||
); | ||
'%'.$DB->sql_like_escape($query).'%', | ||
]; | ||
} | ||
|
||
$rs = $DB->get_recordset_sql($sql, $params, 0, 10); | ||
|
||
foreach ($rs as $r) { | ||
$response->results[] = (object)array( | ||
$response->results[] = (object)[ | ||
'userid' => $r->id, | ||
'firstname' => $r->firstname, | ||
'lastname' => $r->lastname, | ||
'email' => $r->email, | ||
'signature' => sprintf('%s <%s>', fullname($r), $r->email), | ||
); | ||
]; | ||
} | ||
|
||
$rs->close(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// This file is part of Moodle - https://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
|
@@ -12,7 +12,7 @@ | |
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Displays the list of jabber users and lets the user to assign them to real user accounts | ||
|
@@ -21,7 +21,7 @@ | |
* | ||
* @package local_chatlogs | ||
* @copyright 2012 Dan Poltawski <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); | ||
|
@@ -45,7 +45,7 @@ | |
if (!empty($userid)) { | ||
$status = link_jabberid_to_user($jabberid, $userid); | ||
if ($status === false) { | ||
print_error('failed'); | ||
throw new moodle_exception('failed'); | ||
} | ||
} | ||
redirect($PAGE->url); | ||
|
@@ -64,32 +64,32 @@ | |
|
||
$table = new html_table(); | ||
$table->id = 'aliaseseditor'; | ||
$table->head = array( | ||
$table->head = [ | ||
get_string('jabberfullname', 'local_chatlogs'), | ||
get_string('jabberid', 'local_chatlogs'), | ||
get_string('jabberaliasesassign', 'local_chatlogs'), | ||
); | ||
]; | ||
|
||
|
||
foreach ($rs as $record) { | ||
$table->data[] = array( | ||
html_writer::tag('div', s($record->nickname), array('class' => 'aliasdata-authorname')), | ||
html_writer::tag('div', s($record->fromemail), array('class' => 'aliasdata-authoremail')), | ||
$table->data[] = [ | ||
html_writer::tag('div', s($record->nickname), ['class' => 'aliasdata-authorname']), | ||
html_writer::tag('div', s($record->fromemail), ['class' => 'aliasdata-authoremail']), | ||
html_writer::tag('form', | ||
html_writer::tag('div', | ||
html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'jabbernick', 'value' => $record->nickname)). | ||
html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'jabberid', 'value' => $record->fromemail)). | ||
html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey())). | ||
html_writer::empty_tag('input', array('type' => 'text', 'name' => 'search', 'class' => 'aliasdata-search', | ||
'maxlength' => 100, 'size' => 50)). | ||
html_writer::empty_tag('input', array('type' => 'text', 'name' => 'userid', 'class' => 'aliasdata-userid', | ||
'maxlength' => 100, 'size' => 5)). | ||
html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('submit'))). | ||
html_writer::empty_tag('input', array('type' => 'reset', 'value' => get_string('reset'))). | ||
html_writer::tag('span', ' ', array('class' => 'aliasdata-icon')) | ||
html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'jabbernick', 'value' => $record->nickname]). | ||
html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'jabberid', 'value' => $record->fromemail]). | ||
html_writer::empty_tag('input', ['type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()]). | ||
html_writer::empty_tag('input', ['type' => 'text', 'name' => 'search', 'class' => 'aliasdata-search', | ||
'maxlength' => 100, 'size' => 50]). | ||
html_writer::empty_tag('input', ['type' => 'text', 'name' => 'userid', 'class' => 'aliasdata-userid', | ||
'maxlength' => 100, 'size' => 5]). | ||
html_writer::empty_tag('input', ['type' => 'submit', 'value' => get_string('submit')]). | ||
html_writer::empty_tag('input', ['type' => 'reset', 'value' => get_string('reset')]). | ||
html_writer::tag('span', ' ', ['class' => 'aliasdata-icon']) | ||
), | ||
array('method' => 'post', 'action' => $PAGE->url->out())) | ||
); | ||
['method' => 'post', 'action' => $PAGE->url->out()]), | ||
]; | ||
} | ||
echo html_writer::table($table); | ||
$rs->close(); | ||
|
@@ -105,11 +105,11 @@ | |
function link_jabberid_to_user($jabberid, $userid) { | ||
global $DB; | ||
|
||
if (is_null($userid) or is_null($jabberid)) { | ||
if (is_null($userid) || is_null($jabberid)) { | ||
throw new coding_exception('NULL parameter values not allowed here'); | ||
} | ||
|
||
$record = $DB->get_record('local_chatlogs_participants', array('fromemail' => $jabberid)); | ||
$record = $DB->get_record('local_chatlogs_participants', ['fromemail' => $jabberid]); | ||
|
||
if ($record) { | ||
$record->userid = $userid; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// This file is part of Moodle - https://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
|
@@ -12,33 +12,25 @@ | |
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Admin tree class for lazyloading config box | ||
* | ||
* @package local_chatlogs | ||
* @copyright 2012 Dan Poltawski <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* admin_setting_configselect for the seleted cohort | ||
* simply so we can lazy-load the choices. | ||
* admin_setting_configselect for the seleted cohort, so we can lazy-load the choices. | ||
* | ||
* @package local_chatlogs | ||
* @copyright Dan Poltawski <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class local_chatlogs_cohort_selector extends admin_setting_configselect { | ||
|
||
/** Lazy-load the available choices for the select box */ | ||
/** | ||
* Lazy-load the available choices for the select box | ||
*/ | ||
public function load_choices() { | ||
global $DB; | ||
|
||
$this->choices = array(0 => get_string('none')); | ||
if ($cohorts = $DB->get_records_menu('cohort', array('contextid' => context_system::instance()->id), 'name', 'id, name')) { | ||
$this->choices = [0 => get_string('none')]; | ||
if ($cohorts = $DB->get_records_menu('cohort', ['contextid' => context_system::instance()->id], 'name', 'id, name')) { | ||
foreach ($cohorts as $key => $value) { | ||
$this->choices[$key] = $value; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// This file is part of Moodle - https://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
|
@@ -12,21 +12,19 @@ | |
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Defines {@link \local_chatlogs\privacy\provider} class. | ||
* Defines {@see \local_chatlogs\privacy\provider} class. | ||
* | ||
* @package local_chatlogs | ||
* @category privacy | ||
* @copyright 2018 David Mudrák <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace local_chatlogs\privacy; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
use core_privacy\local\metadata\collection; | ||
use core_privacy\local\request\approved_contextlist; | ||
use core_privacy\local\request\contextlist; | ||
|
@@ -38,7 +36,7 @@ | |
* Privacy API implementation for the Developer chat plugin. | ||
* | ||
* @copyright 2018 David Mudrák <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class provider implements | ||
\core_privacy\local\metadata\provider, | ||
|
@@ -50,7 +48,7 @@ class provider implements | |
* @param collection $collection Collection of items to add metadata to. | ||
* @return collection Collection with our added items. | ||
*/ | ||
public static function get_metadata(collection $collection) : collection { | ||
public static function get_metadata(collection $collection): collection { | ||
|
||
$collection->add_database_table('local_chatlogs_messages', [ | ||
'conversationid' => 'privacy:metadata:db:messages:conversationid', | ||
|
@@ -76,7 +74,7 @@ public static function get_metadata(collection $collection) : collection { | |
* @param int $userid ID of the user. | ||
* @return contextlist List of contexts containing the user's personal data. | ||
*/ | ||
public static function get_contexts_for_userid(int $userid) : contextlist { | ||
public static function get_contexts_for_userid(int $userid): contextlist { | ||
|
||
$contextlist = new contextlist(); | ||
$contextlist->add_system_context(); | ||
|
Oops, something went wrong.