Skip to content

Commit

Permalink
feat(discover): 1st deliverable - Basic Features
Browse files Browse the repository at this point in the history
wip(discover): Adding basic features

feat: Adding unit tests

fix: Markdown formatting issues

fix: Remove default value for json datatype column

feat: Adding python library

feat: Add a translation

fix: Remove locale files

Revert "feat: Adding python library"

This reverts commit 7d2db6a.

fix: Do not trigger the default lesson on the installation page

feat: Show "My Lessons" tab only for super-admin profiles

fix: Adding error message when a lesson is completed even though it was already completed

Apply suggestions from code review

fix: Remove lessons files

fix: Remove old lessons compilation

fix: PHP lint

fix: JSON datatype can't have a default value

fix: Twig lint

fix: Missing relation

feat: Adding lessons repository as composer dependency

fix: Make the Discover_User class non-final to allow mocking

I'm not sure that making the class non-final is the best solution. It is necessary to mock the class during unit testing to abstract from the configuration. Nevertheless, the class has been made final to prevent third-party code from extending the class.
fix: Handle null progression field in Discover_User class

fix: Bad table name for tests

fix: Update deprecated method

fix: disable scroll when intro is running

feat: add ending lesson and action engine

chore: add class for lessons menu entry

fix: refresh intro on dropdown animation end to ensure correct zone display

fix: Ensure 'showEndingLesson' is set before accessing it and correct function syntax

chore: Update lessons library reference in composer.lock
  • Loading branch information
ccailly committed Oct 26, 2023
1 parent 43a2546 commit 3cf524a
Show file tree
Hide file tree
Showing 23 changed files with 1,464 additions and 257 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ phpunit.xml
/inventory-vendors/*.json
/locales/*.mo
/inc/downstream.php
/lessons/translated/*/*
!/lessons/translated/.gitkeep
57 changes: 57 additions & 0 deletions ajax/discover.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

/**
* ---------------------------------------------------------------------
*
* GLPI - Gestionnaire Libre de Parc Informatique
*
* http://glpi-project.org
*
* @copyright 2015-2023 Teclib' and contributors.
* @copyright 2003-2014 by the INDEPNET Development Team.
* @licence https://www.gnu.org/licenses/gpl-3.0.html
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* ---------------------------------------------------------------------
*/

use Glpi\Discover\Discover_User;

$AJAX_INCLUDE = 1;
include('../inc/includes.php');

Session::checkLoginUser();

if (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'lesson-done':
if (!isset($_POST['lesson_id'])) {
header('HTTP/1.1 400 Bad Request');
exit();
}

$discover_user = Discover_User::getForUser(Session::getLoginUserID());
$discover_user->setLessonCompleted($_POST['lesson_id']);
break;
}
} else {
header('HTTP/1.1 400 Bad Request');
}
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
"issues": "https://github.com/glpi-project/glpi/issues",
"docs": "https://github.com/glpi-project/doc"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/glpi-project/lessons.git"
}
],
"require": {
"php": ">=8.1",
"ext-ctype": "*",
Expand All @@ -34,6 +40,7 @@
"egulias/email-validator": "^4.0",
"elvanto/litemoji": "^4.1",
"glpi-project/inventory_format": "^1.1",
"glpi-project/lessons": "dev-feature/lessons",
"guzzlehttp/guzzle": "^7.8",
"guzzlehttp/psr7": "^2.6",
"html2text/html2text": "^4.3",
Expand Down
Loading

0 comments on commit 3cf524a

Please sign in to comment.