-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
<?php | ||
|
||
use dokuwiki\Extension\ActionPlugin; | ||
use dokuwiki\Extension\EventHandler; | ||
use dokuwiki\Extension\Event; | ||
|
||
/** | ||
* DokuWiki Plugin lms (Action Component) | ||
* | ||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html | ||
* @author Andreas Gohr <[email protected]> | ||
*/ | ||
class action_plugin_lms extends \dokuwiki\Extension\ActionPlugin | ||
class action_plugin_lms extends ActionPlugin | ||
{ | ||
/** @inheritDoc */ | ||
public function register(Doku_Event_Handler $controller) | ||
public function register(EventHandler $controller) | ||
{ | ||
$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'handleStart'); | ||
$controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handleAction'); | ||
|
@@ -23,7 +27,7 @@ public function register(Doku_Event_Handler $controller) | |
* @param mixed $param optional parameter passed when event was registered | ||
* @return void | ||
*/ | ||
public function handleStart(Doku_Event $event, $param) | ||
public function handleStart(Event $event, $param) | ||
{ | ||
global $JSINFO; | ||
global $INPUT; | ||
|
@@ -45,7 +49,7 @@ public function handleStart(Doku_Event $event, $param) | |
* @param mixed $param optional parameter passed when event was registered | ||
* @return void | ||
*/ | ||
public function handleAction(Doku_Event $event, $param) | ||
public function handleAction(Event $event, $param) | ||
{ | ||
global $INPUT; | ||
global $ID; | ||
|
@@ -89,7 +93,7 @@ public function handleAction(Doku_Event $event, $param) | |
* @param Doku_Event $event | ||
* @return void | ||
*/ | ||
public function handleAdminAjax(Doku_Event $event) | ||
public function handleAdminAjax(Event $event) | ||
{ | ||
if ($event->data !== 'plugin_lms_autocomplete') return; | ||
global $INPUT; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<?php | ||
|
||
use dokuwiki\Extension\AdminPlugin; | ||
use dokuwiki\Form\Form; | ||
|
||
/** | ||
* DokuWiki Plugin lms (Admin Component) | ||
* | ||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html | ||
* @author Andreas Gohr <[email protected]> | ||
*/ | ||
class admin_plugin_lms extends \dokuwiki\Extension\AdminPlugin | ||
class admin_plugin_lms extends AdminPlugin | ||
{ | ||
/** @inheritDoc */ | ||
public function forAdminOnly() | ||
|
@@ -27,7 +30,7 @@ public function html() | |
|
||
echo '<h1>' . $this->getLang('menu') . '</h1>'; | ||
|
||
$form = new dokuwiki\Form\Form(['method' => 'POST', 'id' => 'lms__admin-autocomplete']); | ||
$form = new Form(['method' => 'POST', 'id' => 'lms__admin-autocomplete']); | ||
$form->addTextInput('user', $this->getLang('username')); | ||
$form->addButton('submit', '🔍'); | ||
echo '<p>' . $form->toHTML() . '</p>'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<?php | ||
|
||
use dokuwiki\Extension\Plugin; | ||
|
||
/** | ||
* DokuWiki Plugin lms (Helper Component) | ||
* | ||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html | ||
* @author Andreas Gohr <[email protected]> | ||
*/ | ||
class helper_plugin_lms extends \dokuwiki\Extension\Plugin | ||
class helper_plugin_lms extends Plugin | ||
{ | ||
/** | ||
* Return all lessons and info about the user's current completion status | ||
|
@@ -76,7 +78,7 @@ public function getUserLessons($user) | |
$lessons = []; | ||
$lines = file($file); | ||
foreach ($lines as $line) { | ||
list($time, $id, $seen) = explode("\t", trim($line)); | ||
[$time, $id, $seen] = explode("\t", trim($line)); | ||
|
||
// we use simple log files | ||
if ($seen) { | ||
|
@@ -99,7 +101,7 @@ public function getUserLessons($user) | |
public function getLesson($id, $user) | ||
{ | ||
$all = $this->getLessons($user); | ||
return isset($all[$id]) ? $all[$id] : false; | ||
return $all[$id] ?? false; | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<?php | ||
|
||
use dokuwiki\Extension\SyntaxPlugin; | ||
|
||
/** | ||
* DokuWiki Plugin lms (Syntax Component) | ||
* | ||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html | ||
* @author Andreas Gohr <[email protected]> | ||
*/ | ||
class syntax_plugin_lms_include extends \dokuwiki\Extension\SyntaxPlugin | ||
class syntax_plugin_lms_include extends SyntaxPlugin | ||
{ | ||
/** @var helper_plugin_lms */ | ||
protected $hlp; | ||
|
@@ -51,7 +53,7 @@ public function connectTo($mode) | |
/** @inheritDoc */ | ||
public function handle($match, $state, $pos, Doku_Handler $handler) | ||
{ | ||
$data = array(); | ||
$data = []; | ||
|
||
return $data; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<?php | ||
|
||
use dokuwiki\Extension\SyntaxPlugin; | ||
|
||
/** | ||
* DokuWiki Plugin lms (Syntax Component) | ||
* | ||
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html | ||
* @author Andreas Gohr <[email protected]> | ||
*/ | ||
class syntax_plugin_lms_lms extends \dokuwiki\Extension\SyntaxPlugin | ||
class syntax_plugin_lms_lms extends SyntaxPlugin | ||
{ | ||
/** @var helper_plugin_lms */ | ||
protected $hlp; | ||
|
@@ -51,7 +53,7 @@ public function connectTo($mode) | |
/** @inheritDoc */ | ||
public function handle($match, $state, $pos, Doku_Handler $handler) | ||
{ | ||
$data = array(); | ||
$data = []; | ||
|
||
return $data; | ||
} | ||
|