use Dotclear Helper
This commit is contained in:
parent
0ec5933f13
commit
a5a684506f
@ -16,8 +16,16 @@ namespace Dotclear\Plugin\topWriter;
|
|||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
use form;
|
use Dotclear\Helper\Html\Form\{
|
||||||
use html;
|
Checkbox,
|
||||||
|
Div,
|
||||||
|
Label,
|
||||||
|
Number,
|
||||||
|
Para,
|
||||||
|
Select,
|
||||||
|
Text
|
||||||
|
};
|
||||||
|
use Dotclear\Helper\Html\Html;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup DC_PLUGIN_TOPWRITER
|
* @ingroup DC_PLUGIN_TOPWRITER
|
||||||
@ -41,7 +49,7 @@ class BackendBehaviors
|
|||||||
|
|
||||||
# Display
|
# Display
|
||||||
$__dashboard_items[0][] = '<div class="box small" id="topWriterPostsItems">' .
|
$__dashboard_items[0][] = '<div class="box small" id="topWriterPostsItems">' .
|
||||||
'<h3>' . html::escapeHTML(__('Top writer: entries')) . '</h3>' .
|
'<h3>' . Html::escapeHTML(__('Top writer: entries')) . '</h3>' .
|
||||||
'<ul>' . implode('', $li) . '</ul>' .
|
'<ul>' . implode('', $li) . '</ul>' .
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
@ -58,7 +66,7 @@ class BackendBehaviors
|
|||||||
|
|
||||||
# Display
|
# Display
|
||||||
$__dashboard_items[0][] = '<div class="box small" id="topWriterCommentsItems">' .
|
$__dashboard_items[0][] = '<div class="box small" id="topWriterCommentsItems">' .
|
||||||
'<h3>' . html::escapeHTML(__('Top writer: comments')) . '</h3>' .
|
'<h3>' . Html::escapeHTML(__('Top writer: comments')) . '</h3>' .
|
||||||
'<ul>' . implode('', $li) . '</ul>' .
|
'<ul>' . implode('', $li) . '</ul>' .
|
||||||
'</div>';
|
'</div>';
|
||||||
}
|
}
|
||||||
@ -70,27 +78,38 @@ class BackendBehaviors
|
|||||||
$pref = self::setDefaultPref();
|
$pref = self::setDefaultPref();
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<div class="fieldset">' .
|
(new Div())->items([
|
||||||
'<h4>' . __('Top writer: entries') . '</h4>' .
|
(new Div())->class('fieldset')->items([
|
||||||
'<p><label class="classic" for="topWriterPostsItems">' .
|
(new Text('h4', __('Top writer: entries'))),
|
||||||
form::checkbox('topWriterPostsItems', 1, $pref['topWriterPostsItems']) . ' ' .
|
(new Para())->items([
|
||||||
__('Show') . '</label></p>' .
|
(new Checkbox('topWriterPostsItems', $pref['topWriterPostsItems']))->value(1),
|
||||||
'<p><label class="classic" for="topWriterPostsPeriod">' . __('Period:') . ' </label>' .
|
(new Label(__('Show'), Label::OUTSIDE_LABEL_AFTER))->for('topWriterPostsItems')->class('classic'),
|
||||||
form::combo('topWriterPostsPeriod', Utils::periods(), $pref['topWriterPostsPeriod']) . '</p>' .
|
]),
|
||||||
'<p><label class="classic" for="topWriterPostsLimit">' . __('Limit:') . ' </label>' .
|
(new Para())->class('field')->items([
|
||||||
form::number('topWriterPostsLimit', ['min' => 1, 'max' => 20, 'default' => $pref['topWriterPostsLimit']]) . '</p>' .
|
(new Label(__('Period:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterPostsPeriod'),
|
||||||
'</div>' .
|
(new Select('topWriterPostsPeriod'))->default($pref['topWriterPostsPeriod'])->items(Utils::periods()),
|
||||||
|
]),
|
||||||
'<div class="fieldset">' .
|
(new Para())->class('field')->items([
|
||||||
'<h4>' . __('Top writer: comments') . '</h4>' .
|
(new Label(__('Limit:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterPostsLimit'),
|
||||||
'<p><label class="classic" for="topWriterCommentsItems">' .
|
(new Number('topWriterPostsLimit'))->min(1)->max(20)->value($pref['topWriterPostsLimit']),
|
||||||
form::checkbox('topWriterCommentsItems', 1, $pref['topWriterCommentsItems']) . ' ' .
|
]),
|
||||||
__('Show') . '</label></p>' .
|
]),
|
||||||
'<p><label class="classic" for="topWriterCommentsPeriod">' . __('Period:') . ' </label>' .
|
(new Div())->class('fieldset')->items([
|
||||||
form::combo('topWriterCommentsPeriod', Utils::periods(), $pref['topWriterCommentsPeriod']) . '</p>' .
|
(new Text('h4', __('Top writer: comments'))),
|
||||||
'<p><label class="classic" for="topWriterCommentsLimit">' . __('Limit:') . ' </label>' .
|
(new Para())->items([
|
||||||
form::number('topWriterCommentsLimit', ['min' => 1, 'max' => 20, 'default' => $pref['topWriterCommentsLimit']]) . '</p>' .
|
(new Checkbox('topWriterCommentsItems', $pref['topWriterCommentsItems']))->value(1),
|
||||||
'</div>';
|
(new Label(__('Show'), Label::OUTSIDE_LABEL_AFTER))->for('topWriterCommentsItems')->class('classic'),
|
||||||
|
]),
|
||||||
|
(new Para())->class('field')->items([
|
||||||
|
(new Label(__('Period:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterCommentsPeriod'),
|
||||||
|
(new Select('topWriterCommentsPeriod'))->default($pref['topWriterCommentsPeriod'])->items(Utils::periods()),
|
||||||
|
]),
|
||||||
|
(new Para())->class('field')->items([
|
||||||
|
(new Label(__('Limit:'), Label::OUTSIDE_LABEL_BEFORE))->for('topWriterCommentsLimit'),
|
||||||
|
(new Number('topWriterCommentsLimit'))->min(1)->max(20)->value($pref['topWriterCommentsLimit']),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
])->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function adminAfterDashboardOptionsUpdate(?string $user_id): void
|
public static function adminAfterDashboardOptionsUpdate(?string $user_id): void
|
||||||
|
@ -15,9 +15,9 @@ declare(strict_types=1);
|
|||||||
namespace Dotclear\Plugin\topWriter;
|
namespace Dotclear\Plugin\topWriter;
|
||||||
|
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
use Dotclear\Helper\Html\Html;
|
||||||
use Dotclear\Plugin\widgets\WidgetsStack;
|
use Dotclear\Plugin\widgets\WidgetsStack;
|
||||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||||
use html;
|
|
||||||
|
|
||||||
class Widgets
|
class Widgets
|
||||||
{
|
{
|
||||||
@ -133,7 +133,7 @@ class Widgets
|
|||||||
(bool) $w->content_only,
|
(bool) $w->content_only,
|
||||||
'topcomments ' . $w->class,
|
'topcomments ' . $w->class,
|
||||||
'',
|
'',
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
|
||||||
sprintf('<ul>%s</ul>', implode('', self::lines($lines, 'comments', $w->text)))
|
sprintf('<ul>%s</ul>', implode('', self::lines($lines, 'comments', $w->text)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ class Widgets
|
|||||||
(bool) $w->content_only,
|
(bool) $w->content_only,
|
||||||
'topentries ' . $w->class,
|
'topentries ' . $w->class,
|
||||||
'',
|
'',
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
|
||||||
sprintf('<ul>%s</ul>', implode('', self::lines($lines, 'posts', $w->text)))
|
sprintf('<ul>%s</ul>', implode('', self::lines($lines, 'posts', $w->text)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user