Giter Site home page Giter Site logo

moodle-an-hochschulen / moodle-block_cohortspecifichtml Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 123 KB

This HTML block provides the possibility to selectively display the block to members of specific cohorts.

PHP 82.78% Gherkin 17.22%
moodle moodle-plugin moodle-block

moodle-block_cohortspecifichtml's People

Contributors

abias avatar kathrin84 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

moodle-block_cohortspecifichtml's Issues

The block is not displaying in the dashboard !!

Hi,
I'm running Moodle 3.10 and want to try this plugin in order to give the students a dedicated links in their dashboard (I don't want this links to appear for other user types).

  • I have a cohort All trainees with one user in it,

image

  • I added a block in the default site dashboard and restricted it to the cohort mentioned,

image

  • Logged in with the user in the cohort, but the block didn't appear!

image

Am I missing any options in this setup?!

Best regards,

Plugin files serving does not check the cohort membership

Do I read it right that the function block_cohortspecifichtml_pluginfile() does not check the user's cohort? I agree it is quite an edge case but ideally, it should respect the same access rules as the block_cohortspecifichtml::get_content().

Display Images

Hello

I use the Theme Lambda theme, and I have found that imported images will not show up in the block.

Can you assist please?

Regards
John

Bug in block_cohortspecifichtml_pluginfile() function

I think you may have an operator precedence issue in the function block_cohortspecifichtml_pluginfile() in lib.php. Instead of setting variable $file to a file object, lines 78-80 are setting variable $file to true:

if (!$file = $fs->get_file($context->id, 'block_cohortspecifichtml', 'content',
        0, $filepath, $filename) || $file->is_directory()) {
    send_file_not_found();
}

To address this issue, we have split the code as follows:

$file = $fs->get_file($context->id, 'block_cohortspecifichtml', 'content',
        0, $filepath, $filename);
if ( ($file === false) || ($file->is_directory() === true)) {
    send_file_not_found();
}

Hope this helps.

The 'Configuring the HTML (on cohorts) block with Javascript on' is broken on Moodle 3.9

On Moodle 3.9, a Behat scenario started to fail recently on Moodle 3.9:

001 Scenario: Configuring the HTML (on cohorts) block with Javascript on # /home/runner/work/moodle-block_cohortspecifichtml/moodle-block_cohortspecifichtml/moodle/blocks/cohortspecifichtml/tests/behat/block_cohortspecifichtml.feature:27
      And I add the "HTML (on cohorts)" block                            # /home/runner/work/moodle-block_cohortspecifichtml/moodle-block_cohortspecifichtml/moodle/blocks/cohortspecifichtml/tests/behat/block_cohortspecifichtml.feature:31
        Facebook\WebDriver\Exception\ElementNotInteractableException: element not interactable: element has zero size

The same scenario still works on Moodle 3.10 and 3.11.

SQL query composition

The SQL composed in block_cohortspecifichtml_cohorts_is_member() should be improved to

  • Use placeholders (named or anonymous) instead of directly concatenating the SQL with incoming parameter. This is a good practise even when the parameters comes from safe sources like $USER->id or the block config.
  • Make use of $DB->get_in_or_equal()

Transfer cohort functions to Moodle core

In locallib.php, there are some functions which are used to gather information about multiple cohorts at once.
It would be worthwhile to transfer these functions to Moodle core to /lib/cohortlib.php

Fix codechecker complaints about PHPUnit naming

Github actions started to complain recently about the naming of the existing PHPUnit tests:

FILE: ...odle-block_cohortspecifichtml/moodle-block_cohortspecifichtml/moodle/blocks/cohortspecifichtml/tests/privacy_provider_test.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
 40 | WARNING | PHPUnit testcase name "block_cohortspecifichtml_privacy_testcase" does not match file name
    |         | "privacy_provider_test" (moodle.PHPUnit.TestCaseNames.NoMatch)
 40 | WARNING | PHUnit class "block_cohortspecifichtml_privacy_testcase" does not have any namespace. It is recommended to add it
    |         | to the "block_cohortspecifichtml" namespace, using more levels if needed, in order to match the code being
    |         | tested (moodle.PHPUnit.TestCaseNames.MissingNS)
------------------------------------------------------------------------------------------------------------------------------------

This originates to a change in local_codechecker which was integrated there in moodlehq/moodle-local_codechecker#161

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.