110 Commits

Author SHA1 Message Date
David Carrillo
f0770658fb
MDL-77061 badge: Convert "Manage badges" page to use Report Builder
- Manage badges page is now a Report Builder system report to show
the list of site and course badges.
2023-08-25 12:12:37 +02:00
Andrew Nicols
3d5afd6061
Merge branch 'MDL-75810' of https://github.com/paulholden/moodle 2023-07-09 22:23:29 +08:00
Sara Arjona
abcbeca33d
MDL-78184 badges: Improve user flow for connecting backpack 2023-07-07 08:53:43 +02:00
Paul Holden
ccafa6e657
MDL-75810 badges: tag support in badge custom report sources. 2023-06-26 09:50:45 +01:00
Rodrigo Mady da Silva
4b26d1f784 MDL-74570 core_badges: Add webservice core_badges_get_user_by_hash 2023-06-20 21:14:17 -03:00
Jun Pataleta
620371e7d3 Merge branch 'MDL-73325-master' of https://github.com/ntdat1904/datnguyen_moodle 2023-06-15 11:31:22 +08:00
Sara Arjona
3878c85440 MDL-78102 badges: Check empty backpack email/password
For backpack connection using OBv2.0, email and password can't be
blank.
This patch adds some extra checks to validate this and displays an
error to the users before trying to connect to the backpack.
Besides, the error displayed when any error is returned by the
backpack (like invalid credentials), has also been improved, to
make it clearer for the users.
2023-06-13 11:21:13 +02:00
Damian Hippisley
faa41cd791 MDL-73325 core_badges: Add tags field to BadgeClass 2023-06-09 13:41:07 +01:00
Andrew Nicols
03e4afdb39 MDL-78132 badges: move apiBase consumption to backpack
The logic to create the issuer has been moved to the backpack form
in order to improve the workflow and update the apiBase with the
proper value comming from the badgeconnect.json manifest file.

So, as part of this change in the workflow, the following changes
has been also implemented (to make the UI easier for users):

- The "Open Badges" oAuth issuer button has been removed from the
"OAuth Services" admin page. As they are created/updated when a backpack
is saved, this button is not required anymore.
- The "OAuth2 services" and "Backpack API URL" parameters have been
removed from the Manage backpacks form, because they are created on
the fly each time the backpack is saved.
2023-05-23 08:46:39 +02:00
Meirza
3895529b74 MDL-77350 badges: Added class properties that are not declared
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-05-16 01:03:01 +07:00
Andrew Nicols
bd214de282 MDL-75552 badges: move apiBase consumption to backpack
The apiBase in .well-known/badgeconnect.json was ignored and it was
causing some failures when connecting or sending badges to an
external backpack.
For OBv2.1, it has been changed to always use the apiBase defined
in the badgeconnect.json backpack provider.
2023-05-09 08:50:42 +02:00
Sara Arjona
ed53d81dc7 MDL-77842 badges: Improve debugging information for Badgr
In MDL-77086 some extra information was added when a badge can't be
sent to a backpack. However, as the Badgr is not following the
specification, it's still hard to debug it when it fails (as
raised in MDL-75552, Badgr is not working because, in some cases,
it's returning the "Method Not Allowed / Request method 'POST'
not supported" error.
2023-04-14 13:47:23 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Sara Arjona
597564d7b4 MDL-77086 badges: Improve debugging
Display more information, like the status error, when the badge can't
be sent to the backpack.
2023-02-13 08:40:45 +01:00
Andrew Nicols
edd1fa9218 Merge branch 'MDL-76933' of https://github.com/paulholden/moodle 2023-01-30 11:25:27 +08:00
Sara Arjona
ae53d04144 Merge branch 'MDL-75337-master' of https://github.com/laurentdavid/moodle 2023-01-24 16:07:35 +01:00
Laurent David
fc72a1d7b1 MDL-75337 core: Single button - core changes
* Change all core calls toward single_button to use single_button::BUTTON_PRIMARY
    when needed
2023-01-24 06:01:35 +01:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Paul Holden
ab670ab286 MDL-76933 badges: create user-focused datasource for custom reporting.
This report source differs from the original badges source (5274ee5a)
by making `user` the primary table of the report, allowing for reports
on all users regardless of whether they have been awarded badges.
2023-01-20 10:20:01 +00:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
David Woloszyn
126028cc76 MDL-76183 lib: Update Github URLs 2022-11-30 14:01:31 +11:00
Marina Glancy
064eccd4fc MDL-75525 reportbuilder: specify initial sorting for datasources 2022-11-07 15:43:45 +01:00
Marina Glancy
5a9590dfad MDL-76073 badges: badge RB entity should have nullable callbacks 2022-10-25 10:49:06 +02:00
Paul Holden
208adcf3d1 MDL-73938 reportbuilder: better Oracle support of long text columns.
Specifically during column grouping/aggregation, we need to avoid CLOB
datatype inconsistencies (ORA-00932).
2022-09-05 12:08:54 +01:00
Víctor Déniz
5087f56905 Merge branch 'MDL-75119' of https://github.com/paulholden/moodle 2022-07-19 13:48:58 +01:00
Jun Pataleta
399a922f0d Merge branch 'MDL-74784-master' of https://github.com/sarjona/moodle 2022-07-11 16:54:22 +08:00
Paul Holden
dc60fe6662 MDL-75119 reportbuilder: preload context data for column callbacks.
This prevents additional requests for context instances in the
callback methods, by preloading all required data in the initial
field select.
2022-07-04 13:07:02 +01:00
Paul Holden
5274ee5a25 MDL-73988 badges: implement badges datasource for custom reporting.
Create two entities exposing reportable data on badges and their
recipients, via column and filter definitions.

Create report source bringing them together along with the user and
course entities to provide data for the reportbuilder editor.
2022-05-19 16:43:28 +01:00
Sara Arjona
1cedbd1e19 MDL-74784 core_badges: Fix exception with related badges
System badges with related badges were displaying an error before this patch,
because the is_guest($context) function expects a context_course.
2022-05-18 08:18:33 +02:00
Sara Arjona
bc7dec8c2b MDL-66940 badges: Create page to display badges info
The OBv2.0 specification includes a field "Criteria" for
BadgeClass. Until now, this field was filled using the
URL of the badge assertion, but that is causing some issues
in Badgr because it linked to the badge assertion of the
first user sending this badge to the Badgr backpack (so then,
the following users linked to the first user assertion page
too).

This patch adds a new page, badgeclass.php which will be
used from now to display any badge information which is
not related to any assertion (like happens with the criteria
in BadgeClass).
2022-03-04 12:18:59 +01:00
Paul Holden
a7b940ba7d MDL-72880 badges: change badge exporter issuername field to text.
This matches it's type in the settings pages, and also the type
of the site name used as the default for the setting. It's content
will now be automatically filtered by the external exporter class.
2022-01-07 09:11:35 +00:00
abgreeve
f1d22c9830 MDL-72930 navigation: Update to badges navigation.
This allows navigation nodes injected into the badges section
to be displayed as either a button or a dropdown url_select.
2022-01-04 15:58:52 +08:00
Peter Dias
96dd6c9c94 MDL-72904 core_badges: Introduce tertiary navigation for badges 2021-12-23 21:02:01 +08:00
Sara Arjona
dc631407b5 MDL-73153 badges: get image when it has more data
In some cases, image might have more fields rather than the URL.
This patch is for taking them into account and displaying the image
and also these information properly.
2021-11-24 10:27:15 +01:00
Sara Arjona
88c31c7551 MDL-72141 badges: simplify external badges page
Apart from reorganising the information displayed in the external badges
page, this information has been moved to reuse the template created in
MDL-71937, to make it easier to modify and maintain.
2021-11-24 09:40:19 +01:00
Paul Holden
374114e0f8 MDL-72857 badges: filter site/course name when showing issued badge. 2021-11-01 10:43:10 +00:00
Sara Arjona
24fcc7ebea MDL-71937 badges: simplify badges page
Apart from reorganising the information displayed in the badges page,
this information has been moved to a template in order to make it
easier to modify and maintain.
2021-08-10 15:59:06 +02:00
Sara Arjona
24ff49f681 MDL-71119 core_badges: Add more information to errors
Some errors raised when calling external services were ignored.
Displaying this information helps to debug and find the real reasons
why some action, like connecting to an external backpack, can't be
done.
2021-04-14 10:52:47 +02:00
Sara Arjona
c1649591a2 MDL-71119 core_badges: Use basicauth and remove urlencode
Basic authorization header is required to get token. Besides, client
id and secret shouldn't call urlencode.
2021-04-14 09:18:36 +02:00
Víctor Déniz
25b8cb9783 Merge branch 'MDL-71116-master' of git://github.com/sarjona/moodle 2021-04-08 01:01:15 +01:00
Eloy Lafuente (stronk7)
67b2e62fe7 Merge branch 'MDL-70963-master' of git://github.com/sarjona/moodle 2021-03-29 12:39:32 +02:00
Sara Arjona
51ec496f75 MDL-70963 core_badges: Use expected JSON format for OBv2.1
This patch adds some changes to guarantee that OpenBadges 2.1 (OBv2.1)
will return always the same JSON format that OBv2.0 (because the only
difference between both versions it's the BadgeConnect API).
2021-03-29 10:02:58 +02:00
sam marshall
5e72715e4f MDL-71099 Lib: Move new user_fields class from core to core_user
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.

Since the class has only just been added to Moodle, now is a good
time to move it.
2021-03-25 13:47:23 +00:00
Sara Arjona
2c8de780d5 MDL-71116 core_badges: Backpack URLs with more than 50 chars
Backpack URLs (web and API) can have up to 255. However, the form
for creating/editing them, doesn't allow URLs with more than 50
characters. This patch align limitation to DB value (255).
2021-03-19 15:08:12 +01:00
Jun Pataleta
5a7c629f7c Merge branch 'MDL-45242-master' of https://github.com/sammarshallou/moodle 2021-03-10 23:39:30 +08:00
sam marshall
558cc1b85e MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
2021-03-10 10:57:10 +00:00
Jun Pataleta
644f32784d Merge branch 'MDL-70911-master' of git://github.com/sarjona/moodle 2021-03-10 16:15:43 +08:00
Sara Arjona
49c1d41a60 MDL-70911 core_badges: Remove $CFG->badges_site_backpack
The $CFG->badges_site_backpack setting has been completely removed
because it's not required anymore. From now, the primary site
backpack will be the first one in the "Manage backpacks" list (so,
the one with lower sortorder value).
2021-03-10 09:09:05 +01:00
Sara Arjona
066e998400 MDL-70911 core_badges: Add support to backpacks sortorder
Before removing $CFG->badges_site_backpack setting, admins should be
able to re-order the existing site-backpacks (because then, the first
one will be treated as the default one).
This patch adds the sort order feature to the backpack list.
2021-03-10 08:29:47 +01:00
Sara Arjona
49c5b85eba MDL-63961 core_badges: Use high-resolution image
High-resolution image for a badge (f3) should be sent to external
backpacks through JSON and WS methods.
Besides, when a badge is cloned, the high-resolution image should be
used to avoid the copied looks blurry.
2021-02-22 12:43:06 +01:00