Problem/Motivation

As a user, after completing a course/learning path and being redirected to that course's homepage, I would like a CTA to be presented that allows me to immediately download my certificate.

Proposed resolution

Update LearningPathController::progress to include a conditional view certificate button underneath continue training that prompts user to download certificate PDF.

No update to dependencies needed since already relies on opigno_certificate.

Remaining tasks

Update LearningPathController::progress

User interface changes

Pending completion of a learning path, a 'View Certificate' button will be provided underneath 'Continue Training'.

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

butlerbryanc created an issue. See original summary.

butlerbryanc’s picture

StatusFileSize
new12.9 KB
new4.87 KB

h2. Updates
* Patch attached.
* Styled similar to continue button.
* Replaced background image with Achievements icon from Platon theme.
* On hover, text reads Download Certificate.

Image of expected results with Platon Theme
new certificate button demo

kkohlbrenner’s picture

Status: Active » Needs work

Hi @butlerbryanc

In the attached patch, I see

+    $pdf_route = 'certificate.entity.pdf';

However, I can't find this route in opigno_learning_path.routing.yml. Is this route defined in another opigno routing file?

Regarding this change:

+    if (!empty($is_passed)) {
+      $buttons[] = $view_certificate_button;
+    }

It appears that $is_passed is set to a boolean value.

$is_passed = opigno_learning_path_is_passed($group, $uid);

The function docblock, defined in opigno_learning_path.module, states:

/**
 * Returns LP passed flag.
 *
 * @param array|\Drupal\group\Entity\GroupInterface $step
 *   Learning Path or Course Group entity,
 *   or step array, returned by opigno_learning_path_get_steps()
 * @param int $uid
 *   User ID.
 *
 * @return bool
 *   LP passed flag.
 *
 * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
 * @throws \Drupal\Component\Plugin\Exception\PluginException
 * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
 */
function opigno_learning_path_is_passed($step, $uid) {

Rather than checking,

if (!empty($is_passed)) {}

I think it would be more straight forward if we used,

if ($is_passed) {}

does that make sense?

Additionally, it appears that this feature doesn't include functionality for an administrator to toggle, is that right?

butlerbryanc’s picture

StatusFileSize
new4.87 KB

h2. Updates
* change conditional to just check boolean var $is_passed.

h2. Notes
* @kkohlbrenner there aren't administrative features for configuring these buttons.
* The path you pointed out is from a module that is already a dependency.

butlerbryanc’s picture

Status: Needs work » Needs review

jasonawant made their first commit to this issue’s fork.

jasonawant’s picture

Assigned: butlerbryanc » Unassigned

I've unassigned this issue.

This patch does not currently apply to 8.x-1.12 version.

I think this patch altered the LearningPathController::progress() method. However, this was removed in this commit > https://git.drupalcode.org/project/opigno_learning_path/-/commit/acf5a3e...

Is there an alternative to LearningPathController::progress()

axelm’s picture

Hi,
We are working on a complete redesign of UI with Opigno 3.0 (Drupal 9), in order to integrate a lot of feedbacks from users and improve UX.
Among these feedbacks we considered this one, and we will add several additional CTA allowing to get more direct access to certificates, without visiting achievements page.
This will be introduced at the latest at the beginning of September, so coming soon.

jasonawant’s picture

Thanks for the info.

Regarding my question,

Is there an alternative to LearningPathController::progress()

Could you point me to a replacement? Is there something that can be used to report a student's progress on the course detail page?