62 lines
1.7 KiB
PHP
62 lines
1.7 KiB
PHP
<?php
|
|
|
|
class pluginStaticPages extends Plugin
|
|
{
|
|
|
|
public function init()
|
|
{
|
|
// Fields and default values for the database of this plugin
|
|
$this->dbFields = array(
|
|
'label' => 'Static Pages',
|
|
'homeLink' => true
|
|
);
|
|
}
|
|
|
|
// Method called on the settings of the plugin on the admin area
|
|
public function form()
|
|
{
|
|
global $L;
|
|
|
|
$html = '<div>';
|
|
$html .= '<label>' . $L->get('Label') . '</label>';
|
|
$html .= '<input id="jslabel" name="label" type="text" dir="auto" value="' . $this->getValue('label') . '">';
|
|
$html .= '<span class="tip">' . $L->get('This title is almost always used in the sidebar of the site') . '</span>';
|
|
$html .= '</div>';
|
|
|
|
$html .= '<div>';
|
|
$html .= '<label>' . $L->get('Home link') . '</label>';
|
|
$html .= '<select name="homeLink">';
|
|
$html .= '<option value="true" ' . ($this->getValue('homeLink') === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
|
$html .= '<option value="false" ' . ($this->getValue('homeLink') === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
|
$html .= '</select>';
|
|
$html .= '<span class="tip">' . $L->get('show-the-home-link-on-the-sidebar') . '</span>';
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}
|
|
|
|
// Method called on the sidebar of the website
|
|
public function siteSidebar()
|
|
{
|
|
global $L;
|
|
global $url;
|
|
global $site;
|
|
global $pages;
|
|
|
|
// HTML for sidebar
|
|
$html = '<div class="plugin plugin-static-pages">';
|
|
|
|
// Print the label if not empty
|
|
$label = $this->getValue('label');
|
|
if (!empty($label)) {
|
|
$html .= '<h2 class="plugin-label">' . $label . '</h2>';
|
|
}
|
|
|
|
$html .= '<div class="plugin-content">';
|
|
$html .= MenuHelper::getStatics(-1, $this->getValue('homeLink'));
|
|
$html .= '</div>';
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}
|
|
}
|