Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve/sqlquery #2

Merged
merged 7 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci 4.5.4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci 4.5.4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
Expand Down
11 changes: 5 additions & 6 deletions classes/zoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use local_townsquaresupport\townsquaresupportinterface;

global $CFG;
require_once($CFG->dirroot . '/blocks/townsquare/locallib.php');
require_once($CFG->dirroot . '/blocks/townsquare/lib.php');

/**
* Class that implements the townsquaresupportinterface with the function to get the events from the plugin.
Expand All @@ -55,7 +55,6 @@ public static function get_events(): array {
$zoomevents = self::get_events_from_db();

// Filter out events that the user should not see.
// TODO: are the more filters needed and why?
foreach ($zoomevents as $key => $event) {
if (townsquare_filter_availability($event) ||
($event->eventtype == "expectcompletionon" && townsquare_filter_activitycompletions($event))) {
Expand All @@ -73,7 +72,6 @@ public static function get_events(): array {
* @return array
*/
private static function get_events_from_db(): array {
// TODO: are the more or less parameters or conditions to implement?
global $DB;

// Prepare the parameter for sql query.
Expand All @@ -85,16 +83,17 @@ private static function get_events_from_db(): array {
+ $inparamscourses;

// Set the sql statement.
$sql = "SELECT e.id, e.name, z.name AS instancename , e.courseid, cm.id AS coursemoduleid, cm.availability AS availability, e.groupid, e.userid,
e.modulename, e.instance, e.eventtype, e.timestart, e.timemodified, e.visible
$sql = "SELECT e.id, e.name AS content, z.name AS instancename , e.courseid, cm.id AS coursemoduleid,
cm.availability AS availability, e.groupid, e.userid, e.modulename, e.instance, e.eventtype, e.timestart,
e.timemodified, e.visible
FROM {event} e
JOIN {modules} m ON e.modulename = m.name
JOIN {course_modules} cm ON (cm.course = e.courseid AND cm.module = m.id AND cm.instance = e.instance)
JOIN {zoom} z ON z.id = e.instance
WHERE (e.timestart >= :timestart OR e.timestart+e.timeduration > :timeduration)
AND e.timestart <= :timeend
AND e.courseid $insqlcourses
AND e.modulename = 'ratingallocate'
AND e.modulename = 'zoom'
AND m.visible = 1
AND (e.name NOT LIKE '" .'0'. "' AND e.eventtype NOT LIKE '" .'0'. "' )
AND (e.instance <> 0 AND e.visible = 1)
Expand Down
4 changes: 2 additions & 2 deletions lang/en/townsquareexpansion_zoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Townsquare subplugin for mod_zoom';
$string['pluginname'] = 'Zoom support for townsquare block';
$string['pluginname_help'] = 'This subplugin allows the townsquare block to show events from zoom.';
$string['pluginnameadding'] = "Adding a zoom support subplugin";
$string['pluginnameediting'] = "Editing a zoom support subplugin";
$string['pluginnamesummary'] = "This subplugin allows the townsquare block to show events from zoom.";
$string['pluginname_help'] = 'This subplugin allows the townsquare block to show events from zoom.';
$string['plugintitle'] = 'Zoom support for townsquare block';
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
/**
* Plugin version and other meta-data are defined here.
*
* @package townsquareexpansion_moodleoverflow
* @package townsquareexpansion_zoom
* @copyright 2024 Tamaro Walter
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();
$plugin->component = 'townsquareexpansion_zoom';
$plugin->dependencies = ['local_townsquaresupport' => ANY_VERSION];
$plugin->dependencies = ['local_townsquaresupport' => ANY_VERSION, 'mod_zoom' => ANY_VERSION];
$plugin->release = '0.1.0';
$plugin->version = 2024051400;
$plugin->requires = 2022041900;
Expand Down
Loading