Skip to content

Commit

Permalink
Linting: Linting code
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderJacob committed Dec 14, 2023
1 parent dae4dcf commit aa1b8a7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 29 deletions.
1 change: 0 additions & 1 deletion classes/event/completion_criteria_updated.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static function get_name() {
*/
public function get_description() {
$data = $this->data;
//$contextnamelink = html_writer::link('local/adele/manage_learning_paths.php', $otherarray->contextname);
return get_string('event_completion_criteria_updated_description', 'local_adele', $data['other']['learningpathname']);
}

Expand Down
1 change: 0 additions & 1 deletion classes/event/learnpath_created.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static function get_name() {
*/
public function get_description() {
$data = $this->data;
//$contextnamelink = html_writer::link('local/adele/manage_learning_paths.php', $otherarray->contextname);
return get_string('event_learnpath_created_description', 'local_adele', $data['other']['learningpathname']);
}

Expand Down
1 change: 0 additions & 1 deletion classes/event/learnpath_deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static function get_name() {
*/
public function get_description() {
$data = $this->data;
//$contextnamelink = html_writer::link('local/adele/manage_learning_paths.php', $otherarray->contextname);
return get_string('event_learnpath_deleted_description', 'local_adele', $data['other']['learningpathname']);
}

Expand Down
1 change: 0 additions & 1 deletion classes/event/learnpath_updated.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static function get_name() {
*/
public function get_description() {
$data = $this->data;
//$contextnamelink = html_writer::link('local/adele/manage_learning_paths.php', $otherarray->contextname);
return get_string('event_learnpath_updated_description', 'local_adele', $data['other']['learningpathname']);
}

Expand Down
8 changes: 2 additions & 6 deletions classes/external/observer_course_completed.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,11 @@
* @copyright 2023 Wunderbyte GmbH
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

class observer_course_completed {
/**
* Webservice for the local catquiz plugin to get next question.
* Observer for course completed
*
* @param int $userid
* @param int $learninggoalid
* @return array
* @param object $event
*/
public static function observe($event) {
global $DB;
Expand Down Expand Up @@ -89,6 +86,5 @@ public static function observe($event) {
}
}
}
return 1;
}
}
26 changes: 13 additions & 13 deletions classes/external/observer_course_enrolled.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,20 @@
* @copyright 2023 Wunderbyte GmbH
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

class observer_course_enrolled {
/**
* Webservice for the local catquiz plugin to get next question.
*
* @param int $userid
* @param int $learninggoalid
* @return array
* @param object $event
*/
public static function observe($event) {
global $DB;
$params = $event;
$learningpaths = self::buildsqlquerypath($params->courseid, $DB);
$learningpaths = self::buildsqlquerypath($params->courseid);
if ($learningpaths) {
foreach ($learningpaths as $learningpath) {
$learningpath->json = json_decode($learningpath->json, true);
$userpath = self::buildsqlqueryuserpath($learningpath->id, $params->relateduserid, $DB);
$userpath = self::buildsqlqueryuserpath($learningpath->id, $params->relateduserid);
if (!$userpath) {
$userpathrelation = self::getuserpathrelation($learningpath, $params->relateduserid, $DB);
$DB->insert_record('local_adele_path_user', [
Expand All @@ -73,15 +70,15 @@ public static function observe($event) {
}
}
}
return 1;
}

/**
* Build sql query with config filters.
*
* @return array
* @param object $learningpath
* @return string
*/
public static function getuserpathrelation($learningpath, $userid, $DB) {
public static function getuserpathrelation($learningpath) {
// Using named parameter :courseid in the SQL query.
$completioncriteria = false;
if (!$completioncriteria) {
Expand All @@ -102,7 +99,7 @@ public static function getuserpathrelation($learningpath, $userid, $DB) {
/**
* Build sql query with config filters.
*
* @return array
* @return string
*/
public static function loopcriteria() {
global $DB;
Expand All @@ -115,7 +112,8 @@ public static function loopcriteria() {
* @param string $courseid
* @return array
*/
public static function buildsqlquerypath($courseid, $DB) {
public static function buildsqlquerypath($courseid) {
global $DB;
// Using named parameter :courseid in the SQL query.
$likecourseid = $DB->sql_like('lp.json', ':courseidpattern');
$sql = "SELECT lp.id, lp.json
Expand All @@ -134,10 +132,12 @@ public static function buildsqlquerypath($courseid, $DB) {
/**
* Build sql query with config filters.
*
* @param int $courseid
* @param int $learningpathid
* @param int $userid
* @return array
*/
public static function buildsqlqueryuserpath($learningpathid, $userid, $DB) {
public static function buildsqlqueryuserpath($learningpathid, $userid) {
global $DB;
// Using named parameter :courseid in the SQL query.
$sql = "SELECT *
FROM {local_adele_path_user} lpu
Expand Down
10 changes: 5 additions & 5 deletions db/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.

/**
* Plugin event listeners are defined here.
* Plugin capabilities are defined here.
*
* @package local_catquiz
* @category event
* @copyright 2023 Wunderbyte Gmbh <[email protected]>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package local_adele
* @author Jacob Viertel
* @copyright 2023 Wunderbyte GmbH
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();
Expand Down
2 changes: 1 addition & 1 deletion lang/en/local_adele.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
$string['course_name_condition_course_completed'] = 'Course completed';
$string['course_label_condition_course_completed'] = 'info_text';

// Event Strings
// Event Strings.
$string['event_learnpath_deleted'] = 'Learning path deleted';
$string['event_learnpath_deleted_description'] = 'The learning path {$a} was deleted';
$string['event_learnpath_updated'] = 'Learning path updated';
Expand Down

0 comments on commit aa1b8a7

Please sign in to comment.