*/
class admin_plugin_acknowledge_report extends AdminPlugin
{
/** @inheritdoc */
public function forAdminOnly()
{
return false;
}
/** @inheritdoc */
public function handle()
{
}
/** @inheritdoc */
public function html()
{
global $INPUT;
echo '
';
}
/**
* Show which users have or need ot acknowledge a specific page
*
* @param string $pattern A page assignment pattern
* @param string $user Optional user
*/
protected function htmlPageStatus($pattern, $user = '')
{
global $lang;
global $INPUT;
/** @var helper_plugin_acknowledge $helper */
$helper = plugin_load('helper', 'acknowledge');
$status = $INPUT->str('status');
$pages = $helper->getPagesMatchingPattern($pattern);
$acknowledgements = [];
foreach ($pages as $pattern) {
$acknowledgements = array_merge(
$acknowledgements,
$helper->getPageAcknowledgements($pattern, $user, $status, 1000)
);
if (count($acknowledgements) > 1000) {
// don't show too many
msg($this->getLang('toomanyresults'), 0);
break;
}
}
if (!$acknowledgements) {
echo '
' . $lang['nothingfound'] . '
';
return;
}
$this->htmlTable($acknowledgements);
}
/**
* Show what a given user should sign and has
*
* @param string $user
*/
protected function htmlUserStatus($user)
{
/** @var AuthPlugin $auth */
global $auth;
global $lang;
global $INPUT;
$user = $auth->cleanUser($user);
$userinfo = $auth->getUserData($user, true);
if (!$userinfo) {
echo '
';
}
/**
* Show the latest 100 acknowledgements
*/
protected function htmlLatest()
{
/** @var helper_plugin_acknowledge $helper */
$helper = plugin_load('helper', 'acknowledge');
$acks = $helper->getAcknowledgements();
$this->htmlTable($acks);
echo '
' . $this->getLang('overviewHistory') . '
';
}
/**
* @return void
*/
protected function htmlForms()
{
echo '';
}
/**
* Print the given acknowledge data
*
* @param array $data
* @return int number of acknowledged entries
*/
protected function htmlTable($data)
{
echo '